VSM C++ SDK
Vehicle Specific Modules SDK
piped_request_waiter.h
Go to the documentation of this file.
1 // Copyright (c) 2014, Smart Projects Holdings Ltd
2 // All rights reserved.
3 // See LICENSE file for license details.
4 
8 #ifndef _IO_PIPED_TASK_WAITER_H_
9 #define _IO_PIPED_TASK_WAITER_H_
10 
12 #include <ugcs/vsm/utils.h>
13 #include <ugcs/vsm/sockets.h>
14 
15 #include <atomic>
16 
17 namespace ugcs {
18 namespace vsm {
19 
23 public:
26 
27  virtual
28  ~Piped_request_waiter();
29 
30  virtual void
31  Notify() override;
32 
34  bool
35  Wait(std::chrono::milliseconds timeout = std::chrono::milliseconds(-1));
36 
38  void
39  Ack();
40 
42  sockets::Socket_handle
44  {
45  return read_pipe;
46  }
47 private:
49  sockets::Socket_handle write_pipe = INVALID_SOCKET;
50 
52  sockets::Socket_handle read_pipe = INVALID_SOCKET;
53 
57  std::atomic_bool notified = { false };
58 
59 };
60 
61 } /* namespace vsm */
62 } /* namespace ugcs */
63 
64 #endif /* _IO_PIPED_TASK_WAITER_H_ */
UGCS root namespace.
Definition: android-linux/ugcs/vsm/platform_sockets.h:27
STL namespace.
sockets::Socket_handle Get_wait_pipe()
Get the platform handler of the wait pipe.
Definition: piped_request_waiter.h:43
Various common utilities.
Request container declaration.
void Ack()
Consume one notification event.
virtual void Notify() override
Notify all listeners about request submission.
bool Wait(std::chrono::milliseconds timeout=std::chrono::milliseconds(-1))
Wait for an event for specific amount of time.
#define DEFINE_COMMON_CLASS(__class_name,...)
Use this macro to define some common attributes for a class.
Definition: utils.h:25
Request waiter which uses a pipe to signal about request submissions.
Definition: piped_request_waiter.h:21
Represents request synchronization entity which is used for request queues protected access...
Definition: request_container.h:360