|
Document of c-modernization-kit (porter) 1.0.0
|
非同期送信キューの型定義と操作関数。 More...
Go to the source code of this file.
Data Structures | |
| struct | PotrPayloadElem |
| 送信キューの 1 エントリ。ペイロードエレメント 1 個分のデータを保持する。 More... | |
| struct | PotrSendQueue |
| 非同期送信キュー。 More... | |
Typedefs | |
| typedef pthread_mutex_t | PotrMutex |
| typedef pthread_cond_t | PotrCondVar |
Functions | |
| int | potr_send_queue_init (PotrSendQueue *q, size_t depth, uint16_t max_payload) |
| void | potr_send_queue_destroy (PotrSendQueue *q) |
| int | potr_send_queue_push (PotrSendQueue *q, PotrPeerId peer_id, uint16_t flags, const void *payload, uint16_t payload_len) |
| int | potr_send_queue_push_wait (PotrSendQueue *q, PotrPeerId peer_id, uint16_t flags, const void *payload, uint16_t payload_len, volatile int *running) |
| int | potr_send_queue_pop (PotrSendQueue *q, PotrPayloadElem *out, volatile int *running) |
| int | potr_send_queue_peek (PotrSendQueue *q, PotrPayloadElem *out) |
| int | potr_send_queue_peek_timed (PotrSendQueue *q, PotrPayloadElem *out, uint32_t timeout_ms) |
| int | potr_send_queue_try_pop (PotrSendQueue *q, PotrPayloadElem *out) |
| void | potr_send_queue_complete (PotrSendQueue *q) |
| void | potr_send_queue_wait_drained (PotrSendQueue *q) |
| void | potr_send_queue_shutdown (PotrSendQueue *q) |
非同期送信キューの型定義と操作関数。
ノンブロッキング送信 (potrSend の flags に POTR_SEND_BLOCKING なし) で使用される スレッドセーフな送信キューです。
ペイロードエレメントをリングバッファに積み、送信スレッドが順に sendto で送出します。
ブロッキング送信は potr_send_queue_wait_drained() で先行キューの sendto 完了を待ってから直接送信します。
Definition in file potrSendQueue.h.
| typedef pthread_mutex_t PotrMutex |
Definition at line 32 of file potrSendQueue.h.
| typedef pthread_cond_t PotrCondVar |
Definition at line 33 of file potrSendQueue.h.
|
extern |
Definition at line 51 of file potrSendQueue.c.
References PotrSendQueue::depth, PotrSendQueue::drained, PotrSendQueue::entries, PotrPayloadElem::flags, PotrSendQueue::mutex, PotrSendQueue::not_empty, PotrSendQueue::not_full, PotrPayloadElem::payload, PotrPayloadElem::payload_len, PotrSendQueue::payload_pool, PotrPayloadElem::peer_id, POTR_COND_INIT, POTR_ERROR, POTR_MUTEX_INIT, POTR_PEER_NA, and POTR_SUCCESS.
Referenced by potrOpenService(), and reset_send_queue().
|
extern |
Definition at line 87 of file potrSendQueue.c.
References PotrSendQueue::drained, PotrSendQueue::entries, PotrSendQueue::mutex, PotrSendQueue::not_empty, PotrSendQueue::not_full, PotrSendQueue::payload_pool, POTR_COND_DESTROY, and POTR_MUTEX_DESTROY.
Referenced by potrCloseService(), potrOpenService(), and reset_send_queue().
|
extern |
Definition at line 100 of file potrSendQueue.c.
References PotrSendQueue::count, PotrSendQueue::depth, PotrSendQueue::entries, PotrPayloadElem::flags, PotrSendQueue::inflight, PotrSendQueue::mutex, PotrSendQueue::not_empty, PotrPayloadElem::payload, PotrPayloadElem::payload_len, PotrPayloadElem::peer_id, POTR_COND_SIGNAL, POTR_ERROR, POTR_MUTEX_LOCK, POTR_MUTEX_UNLOCK, POTR_SUCCESS, and PotrSendQueue::tail.
|
extern |
Definition at line 126 of file potrSendQueue.c.
References PotrSendQueue::count, PotrSendQueue::depth, PotrSendQueue::entries, PotrPayloadElem::flags, PotrSendQueue::inflight, PotrSendQueue::mutex, PotrSendQueue::not_empty, PotrSendQueue::not_full, PotrPayloadElem::payload, PotrPayloadElem::payload_len, PotrPayloadElem::peer_id, POTR_COND_SIGNAL, POTR_COND_WAIT, POTR_ERROR, POTR_MUTEX_LOCK, POTR_MUTEX_UNLOCK, POTR_SUCCESS, running, and PotrSendQueue::tail.
Referenced by send_to_peer().
|
extern |
Definition at line 159 of file potrSendQueue.c.
References PotrSendQueue::count, PotrSendQueue::depth, PotrSendQueue::entries, PotrSendQueue::head, PotrSendQueue::inflight, PotrSendQueue::mutex, PotrSendQueue::not_empty, POTR_COND_WAIT, POTR_ERROR, POTR_MUTEX_LOCK, POTR_MUTEX_UNLOCK, POTR_SUCCESS, and running.
Referenced by send_thread_func().
|
extern |
Definition at line 185 of file potrSendQueue.c.
References PotrSendQueue::count, PotrSendQueue::entries, PotrSendQueue::head, PotrSendQueue::mutex, POTR_ERROR, POTR_MUTEX_LOCK, POTR_MUTEX_UNLOCK, and POTR_SUCCESS.
Referenced by send_packed_peer_mode(), and send_thread_func().
|
extern |
Definition at line 202 of file potrSendQueue.c.
References PotrSendQueue::count, PotrSendQueue::entries, PotrSendQueue::head, PotrSendQueue::mutex, PotrSendQueue::not_empty, POTR_ERROR, POTR_MUTEX_LOCK, POTR_MUTEX_UNLOCK, and POTR_SUCCESS.
Referenced by send_thread_func().
|
extern |
Definition at line 238 of file potrSendQueue.c.
References PotrSendQueue::count, PotrSendQueue::depth, PotrSendQueue::entries, PotrSendQueue::head, PotrSendQueue::inflight, PotrSendQueue::mutex, POTR_ERROR, POTR_MUTEX_LOCK, POTR_MUTEX_UNLOCK, and POTR_SUCCESS.
Referenced by send_packed_peer_mode(), and send_thread_func().
|
extern |
Definition at line 258 of file potrSendQueue.c.
References PotrSendQueue::count, PotrSendQueue::drained, PotrSendQueue::inflight, PotrSendQueue::mutex, PotrSendQueue::not_full, POTR_COND_BROADCAST, POTR_COND_SIGNAL, POTR_MUTEX_LOCK, and POTR_MUTEX_UNLOCK.
Referenced by send_packed_peer_mode(), and send_thread_func().
|
extern |
Definition at line 280 of file potrSendQueue.c.
References PotrSendQueue::count, PotrSendQueue::drained, PotrSendQueue::inflight, PotrSendQueue::mutex, POTR_COND_WAIT, POTR_MUTEX_LOCK, and POTR_MUTEX_UNLOCK.
Referenced by potrCloseService(), and send_to_peer().
|
extern |
Definition at line 293 of file potrSendQueue.c.
References PotrSendQueue::mutex, PotrSendQueue::not_empty, PotrSendQueue::not_full, POTR_COND_BROADCAST, POTR_MUTEX_LOCK, and POTR_MUTEX_UNLOCK.
Referenced by potr_send_thread_stop().