Changes in kernel/generic/src/main/shutdown.c [bab75df6:f35749e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/main/shutdown.c
rbab75df6 rf35749e 1 1 /* 2 * Copyright (c) 2025 Jiri Svoboda 2 3 * Copyright (c) 2007 Martin Decky 3 4 * All rights reserved. … … 37 38 38 39 #include <arch.h> 39 #include < proc/task.h>40 #include <errno.h> 40 41 #include <halt.h> 41 42 #include <log.h> 43 #include <main/main.h> 44 #include <main/shutdown.h> 45 #include <proc/task.h> 46 #include <proc/thread.h> 47 48 static thread_t *reboot_thrd = NULL; 49 SPINLOCK_INITIALIZE(reboot_lock); 42 50 43 51 void reboot(void) 44 52 { 45 task_done( );53 task_done(kernel_task); 46 54 47 55 #ifdef CONFIG_DEBUG … … 53 61 } 54 62 63 /** Thread procedure for rebooting the system. 64 * 65 * @param arg Argument (unused) 66 */ 67 static void reboot_thrd_proc(void *arg) 68 { 69 (void)arg; 70 71 reboot(); 72 } 73 74 /** Reboot the system. 75 * 76 * @return EOK if reboot started successfully. EBUSY if reboot already 77 * started, ENOMEM if out of memory. 78 */ 79 sys_errno_t sys_reboot(void) 80 { 81 thread_t *thread; 82 83 thread = thread_create(reboot_thrd_proc, NULL, kernel_task, 84 THREAD_FLAG_NONE, "reboot"); 85 if (thread == NULL) 86 return ENOMEM; 87 88 spinlock_lock(&reboot_lock); 89 90 if (reboot_thrd != NULL) { 91 spinlock_unlock(&reboot_lock); 92 thread_put(thread); 93 return EBUSY; 94 } 95 96 reboot_thrd = thread; 97 98 spinlock_unlock(&reboot_lock); 99 100 thread_start(thread); 101 thread_detach(thread); 102 103 return EOK; 104 } 105 55 106 /** @} 56 107 */
Note:
See TracChangeset
for help on using the changeset viewer.