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
 | 			//       We don't continue execution until the thread has unlocked
 | ||||||
| 			//       the spinlock.
 | 			//       the spinlock.
 | ||||||
| 			s_thread_spinlock.lock(); | 			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) | 				[this] (const Vector<String>* args_ptr) | ||||||
| 				{ | 				{ | ||||||
| 					auto args = *args_ptr; | 					auto args = *args_ptr; | ||||||
| 					s_thread_spinlock.unlock(); | 					s_thread_spinlock.unlock(); | ||||||
| 
 |  | ||||||
| 					args.remove(0); | 					args.remove(0); | ||||||
| 
 | 					PIT::sleep(5000); | ||||||
| 					auto start = PIT::ms_since_boot(); |  | ||||||
| 					while (PIT::ms_since_boot() < start + 5000); |  | ||||||
| 
 |  | ||||||
| 					process_command(args); | 					process_command(args); | ||||||
| 				} | 				} | ||||||
| 			), &arguments); | 			), &arguments)); | ||||||
| 
 | 
 | ||||||
| 			while (s_thread_spinlock.is_locked()); | 			while (s_thread_spinlock.is_locked()); | ||||||
| 		} | 		} | ||||||
|  | @ -215,6 +211,16 @@ argument_done: | ||||||
| 			} | 			} | ||||||
| 			kmalloc_dump_info(); | 			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") | 		else if (arguments.front() == "cpuinfo") | ||||||
| 		{ | 		{ | ||||||
| 			if (arguments.size() != 1) | 			if (arguments.size() != 1) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue