PLCnext API Documentation 25.0.2.69
ManualResetEvent.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/System/Core/PimplPtr.hxx"
9#include "Arp/System/Commons/Threading/Mutex.hpp"
10
12{
13
21{
22public: // usings
24 using Ptr = std::shared_ptr<ManualResetEvent>;
25
26public:
29 explicit ManualResetEvent(bool initial = false);
30
31 // canonical construction/destruction/assignment
32 ManualResetEvent(const ManualResetEvent& arg) = delete;
34 ManualResetEvent& operator=(const ManualResetEvent& arg) = delete;
37
38public: // operations
41 void Set(void);
42
44 void Reset(void);
45
50 bool WaitOne(uint64 timeoutMs = 0);
51
53 void WaitOneInfinite(void);
54
58 bool WaitOneTimed(uint64 timeoutMs);
59
60public: // Impl forward declaration
61 class Impl;
62
63public: // internal operations
64 Impl& GetImpl(void);
65 const Impl& GetImpl(void)const;
66
67private: // Impl usings
68 using Pimpl = PimplPtr<Impl>;
69
70private: // Impl fields
71 Pimpl pimpl;
72};
73
75// inline methods of class ManualResetEvent
76
77} // end of namespace Arp::System::Commons::Threading
Adapter class to implement PImpl idiom.
Definition: PimplPtr.hxx:15
Event object to signal a single thread that an event has occurred. Can be used to synchronize threads...
Definition: ManualResetEvent.hpp:21
bool WaitOne(uint64 timeoutMs=0)
Suspends thread execution until event is signaled by another thread.
Definition: ManualResetEvent.cpp:35
void Reset(void)
Resets the event state to non-signaled.
Definition: ManualResetEvent.cpp:55
ManualResetEvent & operator=(ManualResetEvent &&arg) noexcept
Default move-assignment operator.
ManualResetEvent(bool initial=false)
Creates a new object with specified initial state.
Definition: ManualResetEvent.cpp:9
ManualResetEvent(ManualResetEvent &&arg) noexcept
Default move constructor.
std::shared_ptr< ManualResetEvent > Ptr
Definition of a pointer in the context of an ManualResetEvent.
Definition: ManualResetEvent.hpp:24
void Set(void)
Sets the event to signaled state.
Definition: ManualResetEvent.cpp:50
bool WaitOneTimed(uint64 timeoutMs)
Suspends thread execution until event is signaled by another thread.
Definition: ManualResetEvent.cpp:45
Impl & GetImpl(void)
For internal use only.
Definition: ManualResetEvent.cpp:24
void WaitOneInfinite(void)
Suspends thread execution until event is signaled by another thread.
Definition: ManualResetEvent.cpp:40
std::uint64_t uint64
The Arp unsigned integer type of 8 byte size.
Definition: PrimitiveTypes.hpp:37
Namespace for classes handling threads and synchronization