Changes in kernel/generic/src/main/shutdown.c [f35749e:bab75df6] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/main/shutdown.c
rf35749e rbab75df6 1 1 /* 2 * Copyright (c) 2025 Jiri Svoboda3 2 * Copyright (c) 2007 Martin Decky 4 3 * All rights reserved. … … 38 37 39 38 #include <arch.h> 40 #include < errno.h>39 #include <proc/task.h> 41 40 #include <halt.h> 42 41 #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);50 42 51 43 void reboot(void) 52 44 { 53 task_done( kernel_task);45 task_done(); 54 46 55 47 #ifdef CONFIG_DEBUG … … 61 53 } 62 54 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 already77 * 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 106 55 /** @} 107 56 */
Note:
See TracChangeset
for help on using the changeset viewer.