libxr  1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
LibXR::Topic::SyncBlock Struct Reference

同步订阅者自己挂的数据块 / Data block owned by one synchronous subscriber More...

#include <sync.hpp>

Inheritance diagram for LibXR::Topic::SyncBlock:
[legend]
Collaboration diagram for LibXR::Topic::SyncBlock:
[legend]

Public Types

enum  WaitState : uint32_t { WAIT_IDLE = 0 , WAITING = 1 , WAIT_CLAIMED = 2 }
 同步等待状态 / Synchronous wait state More...
 

Data Fields

void * buff_addr
 收到消息后要拷到这里。Received payloads are copied here.
 
void(* copy_payload )(void *dst, void *payload_addr)
 按订阅精确类型执行负载拷贝的适配函数。Adapter that copies one payload using the subscriber's exact type.
 
MicrosecondTimestamp timestamp
 这里对应那份数据的时间戳。Timestamp paired with the buffered data.
 
std::atomic< uint32_t > wait_state = WAIT_IDLE
 当前 Wait() 的挂起状态。Current pending state of Wait().
 
Semaphore sem
 用来唤醒 Wait() 的信号量。Semaphore used to wake Wait().
 
- Data Fields inherited from LibXR::Topic::SuberBlock
SuberType type
 订阅块的具体种类。Concrete kind of this subscriber block.
 

Detailed Description

同步订阅者自己挂的数据块 / Data block owned by one synchronous subscriber

同步订阅者挂在 topic 链表里的数据块 / Subscriber block used by one synchronous subscriber inside the topic list

Definition at line 11 of file sync.hpp.

Member Enumeration Documentation

◆ WaitState

同步等待状态 / Synchronous wait state

WAIT_CLAIMED 表示这次唤醒已经归超时前那一次 Wait() 所有,直到它把 semaphore post 消费掉为止;否则下一次 Wait() 可能会错误抢走旧唤醒。 WAIT_CLAIMED means the wakeup already belongs to the Wait() that timed out just before the post and must stay reserved until that waiter consumes the semaphore post; otherwise a later Wait() could steal the old wakeup.

Enumerator
WAIT_IDLE 

当前没有挂起等待。No wait is currently pending.

WAITING 

当前有一个挂起的等待者。One waiter is currently pending.

WAIT_CLAIMED 

某次发布已归一个刚超时的等待者所有。One publish wakeup is reserved for a waiter that just timed out.

Definition at line 23 of file sync.hpp.

24 {
25 WAIT_IDLE = 0,
26 WAITING = 1,
27 WAIT_CLAIMED = 2
28 };
@ WAIT_IDLE
当前没有挂起等待。No wait is currently pending.
Definition sync.hpp:25
@ WAITING
当前有一个挂起的等待者。One waiter is currently pending.
Definition sync.hpp:26
@ WAIT_CLAIMED
某次发布已归一个刚超时的等待者所有。One publish wakeup is reserved for a waiter that just timed out.
Definition sync.hpp:27

Field Documentation

◆ buff_addr

void* LibXR::Topic::SyncBlock::buff_addr

收到消息后要拷到这里。Received payloads are copied here.

Definition at line 30 of file sync.hpp.

◆ copy_payload

void(* LibXR::Topic::SyncBlock::copy_payload) (void *dst, void *payload_addr)

按订阅精确类型执行负载拷贝的适配函数。Adapter that copies one payload using the subscriber's exact type.

Definition at line 31 of file sync.hpp.

◆ sem

Semaphore LibXR::Topic::SyncBlock::sem

用来唤醒 Wait() 的信号量。Semaphore used to wake Wait().

Definition at line 35 of file sync.hpp.

◆ timestamp

MicrosecondTimestamp LibXR::Topic::SyncBlock::timestamp

这里对应那份数据的时间戳。Timestamp paired with the buffered data.

Definition at line 33 of file sync.hpp.

◆ wait_state

std::atomic<uint32_t> LibXR::Topic::SyncBlock::wait_state = WAIT_IDLE

当前 Wait() 的挂起状态。Current pending state of Wait().

Definition at line 34 of file sync.hpp.


The documentation for this struct was generated from the following file: