xtd 0.2.0
Loading...
Searching...
No Matches
countdown_event.h
Go to the documentation of this file.
1
4#pragma once
6#include "wait_handle.h"
7#include "../object.h"
8#include "../time_span.h"
9
11namespace xtd {
13 namespace threading {
29 struct data;
30 public:
32
38 explicit countdown_event(int32 initial_count);
40
44 countdown_event(const countdown_event&) = default;
45 countdown_event& operator =(const countdown_event& other);
48
50
56
61
66 bool is_set() const;
67
77
79
84 void add_count();
90 void add_count(int32 count);
91
93 void close();
94
98 void reset();
104 void reset(int32 count);
105
110 bool signal();
117 bool signal(int32 signal_count);
118
121 bool try_add_count() noexcept;
125 bool try_add_count(int32 count) noexcept;
126
130 void wait();
136 bool wait(int32 milliseconds_timeout);
148 bool wait(const time_span& timeout);
156 bool wait(int32 milliseconds_timeout, const cancellation_token& cancellation_token);
166
167 private:
168 std::shared_ptr<data> data_;
169 bool wait_wtih_cancellation_token();
170 bool wait_wtih_cancellation_token(int32 milliseconds_timeout);
171 };
172 }
173}
Contains xtd::threading::cancellation_token class.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:32
Propagates notification that operations should be canceled.
Definition cancellation_token.h:37
Represents a synchronization primitive that is signaled when its count reaches zero.
Definition countdown_event.h:28
int32 current_count() const
Gets the number of remaining signals required to set the event.
bool try_add_count() noexcept
Attempts to increment xtd::threading::countdown_event::current_count by one.
countdown_event(int32 initial_count)
Initializes a new instance of xtd::threading::countdown_event class with the specified count.
const xtd::threading::wait_handle & wait_handle() const
Gets a xtd::threading::wait_handle that is used to wait for the event to be set.
void add_count()
Increments the xtd::threading::countdown_event's current count by one.
void reset(int32 count)
Resets the xtd::threading::countdown_event::initial_count property to a specified value.
bool signal()
Registers a signal with the xtd::threading::countdown_event, decrementing the value of xtd::threading...
bool is_set() const
ndicates whether the xtd::threading::countdown_event object's current count has reached zero.
void add_count(int32 count)
Increments the xtd::threading::countdown_event's current count by one.
xtd::threading::wait_handle & wait_handle()
Gets a xtd::threading::wait_handle that is used to wait for the event to be set.
void reset()
Resets the xtd::threading::countdown_event to the value of xtd::threading::countdown_event::initial_c...
void close()
Close the current instance of the xtd::threading::countdown_event class.
bool signal(int32 signal_count)
Registers multiple signals with the xtd::threading::countdown_event, decrementing the value of xtd::t...
int32 initial_count() const
Gets the numbers of signals initially required to set the event.
Contains a constant used to specify an infinite amount of time. This class cannot be inherited.
Definition timeout.h:31
Encapsulates operating system specific objects that wait for exclusive access to shared resources.
Definition wait_handle.h:50
#define core_export_
Define shared library export.
Definition core_export.h:13
int_least32_t int32
Represents a 32-bit signed integer.
Definition types.h:131
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Represents a time interval.
Definition time_span.h:26
Contains xtd::threading::wait_handle exception.