mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-30 22:42:45 +00:00 
			
		
		
		
	 e1a6f8a27d
			
		
	
	
		e1a6f8a27d
		
	
	
	
	
		
			
			This library is meant to provide C++-style wrappers over lower level APIs such as syscalls and pthread_* functions, as well as utilities for easily running pieces of logic on different threads.
		
			
				
	
	
		
			23 lines
		
	
	
	
		
			345 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
	
		
			345 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <AK/Function.h>
 | |
| #include <LibCore/CObject.h>
 | |
| 
 | |
| namespace LibThread {
 | |
| 
 | |
| class Thread final : public CObject {
 | |
|     C_OBJECT(Thread);
 | |
| 
 | |
| public:
 | |
|     explicit Thread(Function<int()> action);
 | |
|     virtual ~Thread();
 | |
| 
 | |
|     void start();
 | |
|     void quit(int code = 0);
 | |
| 
 | |
| private:
 | |
|     Function<int()> m_action;
 | |
|     int m_tid { -1 };
 | |
| };
 | |
| 
 | |
| }
 |