libxr  1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
semaphore.hpp
1#pragma once
2
3#include "libxr_def.hpp"
4#include "libxr_system.hpp"
5
6namespace LibXR
7{
8
23{
24 public:
37 Semaphore(uint32_t init_count = 0);
38
43 ~Semaphore();
44
56 void Post();
57
71 void PostFromCallback(bool in_isr);
72
88 ErrorCode Wait(uint32_t timeout = UINT32_MAX);
89
101 size_t Value();
102
103 private:
104 libxr_semaphore_handle semaphore_handle_;
105};
106
107} // namespace LibXR
信号量类,实现线程同步机制 Semaphore class implementing thread synchronization
Definition semaphore.hpp:23
void Post()
释放(增加)信号量 Releases (increments) the semaphore
Definition semaphore.cpp:23
void PostFromCallback(bool in_isr)
从中断回调中释放(增加)信号量 Releases (increments) the semaphore from an ISR (Interrupt Service Routine)
Definition semaphore.cpp:48
~Semaphore()
析构信号量对象,释放资源 Destroys the semaphore object and releases resources
Definition semaphore.cpp:17
libxr_semaphore_handle semaphore_handle_
信号量句柄 Semaphore handle
Semaphore(uint32_t init_count=0)
构造一个信号量对象 Constructs a semaphore object
Definition semaphore.cpp:12
size_t Value()
获取当前信号量的值 Gets the current value of the semaphore
Definition semaphore.cpp:54
ErrorCode Wait(uint32_t timeout=UINT32_MAX)
等待(减少)信号量 Waits (decrements) the semaphore
Definition semaphore.cpp:25
LibXR 命名空间
Definition ch32_gpio.hpp:9