mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 02:02:45 +00:00 
			
		
		
		
	 0b38a553b1
			
		
	
	
		0b38a553b1
		
	
	
	
	
		
			
			Thread now has an optional thread_name parameter to the consturctor that will call pthread_setname_np if given.
		
			
				
	
	
		
			25 lines
		
	
	
	
		
			428 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
	
		
			428 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <AK/Function.h>
 | |
| #include <AK/String.h>
 | |
| #include <LibCore/CObject.h>
 | |
| 
 | |
| namespace LibThread {
 | |
| 
 | |
| class Thread final : public CObject {
 | |
|     C_OBJECT(Thread);
 | |
| 
 | |
| public:
 | |
|     explicit Thread(Function<int()> action, StringView thread_name = nullptr);
 | |
|     virtual ~Thread();
 | |
| 
 | |
|     void start();
 | |
|     void quit(int code = 0);
 | |
| 
 | |
| private:
 | |
|     Function<int()> m_action;
 | |
|     int m_tid { -1 };
 | |
|     String m_thread_name;
 | |
| };
 | |
| 
 | |
| }
 |