| 
									
										
										
										
											2019-02-10 14:28:39 +01:00
										 |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <AK/Function.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-10 17:35:43 +02:00
										 |  |  | class CNotifier { | 
					
						
							| 
									
										
										
										
											2019-02-10 14:28:39 +01:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2019-06-07 17:13:23 +02:00
										 |  |  |     enum Event { | 
					
						
							| 
									
										
										
										
											2019-05-28 11:53:16 +02:00
										 |  |  |         None = 0, | 
					
						
							|  |  |  |         Read = 1, | 
					
						
							|  |  |  |         Write = 2, | 
					
						
							| 
									
										
										
										
											2019-02-10 14:28:39 +01:00
										 |  |  |         Exceptional = 4, | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2019-04-10 17:35:43 +02:00
										 |  |  |     CNotifier(int fd, unsigned event_mask); | 
					
						
							|  |  |  |     ~CNotifier(); | 
					
						
							| 
									
										
										
										
											2019-02-10 14:28:39 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-10 17:35:43 +02:00
										 |  |  |     Function<void()> on_ready_to_read; | 
					
						
							|  |  |  |     Function<void()> on_ready_to_write; | 
					
						
							| 
									
										
										
										
											2019-02-10 14:28:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     int fd() const { return m_fd; } | 
					
						
							|  |  |  |     unsigned event_mask() const { return m_event_mask; } | 
					
						
							| 
									
										
										
										
											2019-04-08 04:53:45 +02:00
										 |  |  |     void set_event_mask(unsigned event_mask) { m_event_mask = event_mask; } | 
					
						
							| 
									
										
										
										
											2019-02-10 14:28:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     int m_fd { -1 }; | 
					
						
							|  |  |  |     unsigned m_event_mask { 0 }; | 
					
						
							|  |  |  | }; |