xtd 0.2.0
Loading...
Searching...
No Matches
unnamed_semaphore.h
Go to the documentation of this file.
1
4#pragma once
6#if !defined(__XTD_CORE_NATIVE_LIBRARY__)
7#error "Do not include this file: Internal use only"
8#endif
10
11#include <xtd/core_native_export>
12#include <cstddef>
13#include <cstdint>
14#include <string>
15
17namespace xtd {
19 namespace threading {
20 class semaphore;
21 }
23
26 namespace native {
35 class core_native_export_ unnamed_semaphore final {
36 unnamed_semaphore() = delete;
38 protected:
40
45 static intmax_t create(int32_t initial_count, int32_t max_count);
46
51 static void destroy(intmax_t handle);
52
57 static intmax_t open(const std::string& name);
58
63 static bool signal(intmax_t handle, int32_t release_count, int32_t& previous_count, bool& io_error);
64
74 static uint32_t wait(intmax_t handle, int32_t milliseconds_timeout);
76 };
77 }
78}
Contains unnamed_semaphore native API.
Definition unnamed_semaphore.h:35
static intmax_t create(int32_t initial_count, int32_t max_count)
Create named semaphore with specified initial count and maxixum count.
static void destroy(intmax_t handle)
Destroy named semaphore with specified semaphore handle.
static intmax_t open(const std::string &name)
Open named semaphore with specified name.
static bool signal(intmax_t handle, int32_t release_count, int32_t &previous_count, bool &io_error)
Signal named semaphore with specified semaphore handle.
static uint32_t wait(intmax_t handle, int32_t milliseconds_timeout)
Wait named semaphore with specified semaphore handle and timeout.
Limits the number of threads that can access a resource or pool of resources concurrently.
Definition semaphore.h:38
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10