xtd 0.2.0
Loading...
Searching...
No Matches
named_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 {
34 class core_native_export_ named_semaphore final {
35 named_semaphore() = delete;
37 protected:
39
45 static intmax_t create(int32_t initial_count, int32_t max_count, const std::string& name);
46
51 static void destroy(intmax_t handle, const std::string& name);
52
56 static size_t max_name_size();
57
62 static intmax_t open(const std::string& name);
63
68 static bool signal(intmax_t handle, int32_t release_count, int32_t& previous_count, bool& io_error);
69
79 static uint32_t wait(intmax_t handle, int32_t milliseconds_timeout);
81 };
82 }
83}
Contains named_semaphore native API.
Definition named_semaphore.h:34
static intmax_t create(int32_t initial_count, int32_t max_count, const std::string &name)
Create named semaphore with specified name, initial count and maxixum count.
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 intmax_t open(const std::string &name)
Open named semaphore with specified name.
static size_t max_name_size()
Gets the maximum name size supported.
static void destroy(intmax_t handle, const std::string &name)
Destroy 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