# porter/libsrc/porter/infra/potrSendQueue.c

# 1 ファイル

## 1.1 porter/libsrc/porter/infra/potrSendQueue.c

非同期送信キューの実装。

### 1.1.1 作者

c-modernization-kit sample team

### 1.1.2 バージョン

1.0.0

### 1.1.3 日付

2026/03/08

### 1.1.4 著作権

Copyright (C) CompanyName, Ltd. 2026. All rights reserved.

# 2 関数

## 2.1 potr_send_queue_init

    int potr_send_queue_init ( PotrSendQueue *q, size_t depth, uint16_t max_payload )

## 2.2 potr_send_queue_destroy

    void potr_send_queue_destroy ( PotrSendQueue *q )

## 2.3 potr_send_queue_push

    int potr_send_queue_push ( PotrSendQueue *q, PotrPeerId peer_id, uint16_t flags, const void *payload, uint16_t payload_len )

## 2.4 potr_send_queue_push_wait

    int potr_send_queue_push_wait ( PotrSendQueue *q, PotrPeerId peer_id, uint16_t flags, const void *payload, uint16_t payload_len, volatile int *running )

## 2.5 potr_send_queue_pop

    int potr_send_queue_pop ( PotrSendQueue *q, PotrPayloadElem *out, volatile int *running )

## 2.6 potr_send_queue_peek

    int potr_send_queue_peek ( PotrSendQueue *q, PotrPayloadElem *out )

## 2.7 potr_send_queue_peek_timed

    int potr_send_queue_peek_timed ( PotrSendQueue *q, PotrPayloadElem *out, uint32_t timeout_ms )

## 2.8 potr_send_queue_try_pop

    int potr_send_queue_try_pop ( PotrSendQueue *q, PotrPayloadElem *out )

## 2.9 potr_send_queue_complete

    void potr_send_queue_complete ( PotrSendQueue *q )

## 2.10 potr_send_queue_wait_drained

    void potr_send_queue_wait_drained ( PotrSendQueue *q )

## 2.11 potr_send_queue_shutdown

    void potr_send_queue_shutdown ( PotrSendQueue *q )

# 3 定数、マクロ

## 3.1 POTR_MUTEX_INIT

    #define POTR_MUTEX_INIT ( m )
        pthread_mutex_init((m), NULL)

## 3.2 POTR_MUTEX_LOCK

    #define POTR_MUTEX_LOCK ( m )
        pthread_mutex_lock(m)

## 3.3 POTR_MUTEX_UNLOCK

    #define POTR_MUTEX_UNLOCK ( m )
        pthread_mutex_unlock(m)

## 3.4 POTR_MUTEX_DESTROY

    #define POTR_MUTEX_DESTROY ( m )
        pthread_mutex_destroy(m)

## 3.5 POTR_COND_INIT

    #define POTR_COND_INIT ( c )
        pthread_cond_init((c), NULL)

## 3.6 POTR_COND_WAIT

    #define POTR_COND_WAIT ( c, m )
        pthread_cond_wait((c), (m))

## 3.7 POTR_COND_SIGNAL

    #define POTR_COND_SIGNAL ( c )
        pthread_cond_signal(c)

## 3.8 POTR_COND_BROADCAST

    #define POTR_COND_BROADCAST ( c )
        pthread_cond_broadcast(c)

## 3.9 POTR_COND_DESTROY

    #define POTR_COND_DESTROY ( c )
        pthread_cond_destroy(c)