| 1 | #include "../../includes/linux/InotifyEventLoop.h" |
| 2 | |
| 3 | InotifyEventLoop::InotifyEventLoop( |
| 4 | int inotifyInstance, |
| 5 | InotifyService *inotifyService |
| 6 | ) : |
| 7 | mInotifyInstance(inotifyInstance), |
| 8 | mInotifyService(inotifyService) |
| 9 | { |
| 10 | mStarted = !pthread_create( |
| 11 | &mEventLoop, |
| 12 | NULL, |
| 13 | [](void *eventLoop)->void * { |
| 14 | ((InotifyEventLoop *)eventLoop)->work(); |
| 15 | return NULL; |
| 16 | }, |
| 17 | (void *)this |
| 18 | ); |
| 19 | if (mStarted) { mLoopingSemaphore.wait(); } |
| 20 | } |
| 21 | |
| 22 | bool InotifyEventLoop::isLooping() { |
| 23 | return mStarted; |