NymphRPC Remote Procedure Call Library
worker.h
1 /*
2  worker.h - Header file for the Worker class.
3 
4  Revision 0
5 
6  Notes:
7  -
8 
9  2016/11/19, Maya Posch
10  (c) Nyanko.ws
11 */
12 
13 
14 #pragma once
15 #ifndef WORKER_H
16 #define WORKER_H
17 
18 #include "abstract_request.h"
19 
20 #include <condition_variable>
21 #include <mutex>
22 
23 
24 class Worker {
25  std::condition_variable cv;
26  std::mutex mtx;
27  AbstractRequest* request;
28  bool running;
29  bool ready;
30 
31 public:
32  Worker() { running = true; ready = false; }
33  void run();
34  void stop() { running = false; }
35  void setRequest(AbstractRequest* request) { this->request = request; ready = true; }
36  void getCondition(std::condition_variable* &cv);
37  void getMutex(std::mutex* &mtx);
38 };
39 
40 #endif
Definition: abstract_request.h:22
Definition: worker.h:24