Changeset b79207d in mainline
- Timestamp:
- 2019-07-18T17:19:02Z (5 years ago)
- Parents:
- bb580548
- Location:
- kernel/generic
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/shutdown.h
rbb580548 rb79207d 47 47 extern void reboot(void); 48 48 extern void arch_reboot(void); 49 extern void abort_shutdown(void); 49 50 extern sys_errno_t sys_shutdown(sysarg_t mode, sysarg_t delay, sysarg_t kconsole); 50 51 -
kernel/generic/src/console/cmd.c
rbb580548 rb79207d 880 880 int cmd_reboot(cmd_arg_t *argv) 881 881 { 882 abort_shutdown(); 882 883 reboot(); 883 884 … … 1125 1126 int cmd_halt(cmd_arg_t *argv) 1126 1127 { 1128 abort_shutdown(); 1127 1129 halt(); 1128 1130 return 1; -
kernel/generic/src/main/shutdown.c
rbb580548 rb79207d 98 98 } 99 99 100 void abort_shutdown() 101 { 102 irq_spinlock_lock(&threads_lock, true); 103 thread_t *thread = atomic_load(&shutdown_thread); 104 if (thread != NULL) { 105 thread_interrupt(thread); 106 atomic_store(&shutdown_thread, NULL); 107 } 108 irq_spinlock_unlock(&threads_lock, true); 109 } 110 100 111 /* argument structure for the shutdown thread */ 101 112 typedef struct { … … 135 146 #endif 136 147 137 irq_spinlock_lock(&threads_lock, true); 138 thread_t *thread = atomic_load(&shutdown_thread); 139 if (thread != NULL) { 140 thread_interrupt(thread); 141 atomic_store(&shutdown_thread, NULL); 142 } 143 irq_spinlock_unlock(&threads_lock, true); 148 abort_shutdown(); 144 149 145 150 /* `cancel` or default has been called */ … … 165 170 arg->delay = delay; 166 171 167 thread = thread_create(sys_shutdown_function, arg, kernel_task, THREAD_FLAG_NONE, "shutdown");172 thread_t *thread = thread_create(sys_shutdown_function, arg, kernel_task, THREAD_FLAG_NONE, "shutdown"); 168 173 169 174 if (thread == NULL) {
Note:
See TracChangeset
for help on using the changeset viewer.