forked from Bananymous/banan-os
				
			Kernel: Shell's thread now uses sleep instead of polling
Also added 'sleep' command that just sleeps for 5 seconds
This commit is contained in:
		
							parent
							
								
									1bd8b0fe5c
								
							
						
					
					
						commit
						0506fee34a
					
				|  | @ -189,20 +189,16 @@ argument_done: | |||
| 			//       We don't continue execution until the thread has unlocked
 | ||||
| 			//       the spinlock.
 | ||||
| 			s_thread_spinlock.lock(); | ||||
| 			Scheduler::get().add_thread(Function<void(const Vector<String>*)>( | ||||
| 			MUST(Scheduler::get().add_thread(Function<void(const Vector<String>*)>( | ||||
| 				[this] (const Vector<String>* args_ptr) | ||||
| 				{ | ||||
| 					auto args = *args_ptr; | ||||
| 					s_thread_spinlock.unlock(); | ||||
| 
 | ||||
| 					args.remove(0); | ||||
| 
 | ||||
| 					auto start = PIT::ms_since_boot(); | ||||
| 					while (PIT::ms_since_boot() < start + 5000); | ||||
| 
 | ||||
| 					PIT::sleep(5000); | ||||
| 					process_command(args); | ||||
| 				} | ||||
| 			), &arguments); | ||||
| 			), &arguments)); | ||||
| 
 | ||||
| 			while (s_thread_spinlock.is_locked()); | ||||
| 		} | ||||
|  | @ -215,6 +211,16 @@ argument_done: | |||
| 			} | ||||
| 			kmalloc_dump_info(); | ||||
| 		} | ||||
| 		else if (arguments.front() == "sleep") | ||||
| 		{ | ||||
| 			if (arguments.size() != 1) | ||||
| 			{ | ||||
| 				TTY_PRINTLN("'sleep' does not support command line arguments"); | ||||
| 				return; | ||||
| 			} | ||||
| 			PIT::sleep(5000); | ||||
| 			TTY_PRINTLN("done"); | ||||
| 		} | ||||
| 		else if (arguments.front() == "cpuinfo") | ||||
| 		{ | ||||
| 			if (arguments.size() != 1) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue