porter/libsrc/porter/thread/potrHealthThread.c

1 ファイル

1.1 porter/libsrc/porter/thread/potrHealthThread.c

ヘルスチェックスレッドモジュール。

送信者側で動作する定周期 PING 送信スレッドです。
health_interval_ms 周期で PING パケットを送信します。
受信者側から送信者へのヘルスチェックは行いません (一方向ヘルスチェック)。

1.1.1 作者

c-modernization-kit sample team

1.1.2 バージョン

1.0.0

1.1.3 日付

2026/03/08

1.1.4 インクルード元

potrHealthThread.c のインクルード元

1.1.5 著作権

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

2 関数

2.1 health_sleep

static void health_sleep ( struct PotrContext_ *ctx, int path_idx, uint32_t interval_ms )

2.1.1 呼び出し元

health_sleep の呼び出し元

2.2 health_get_ms

static uint64_t health_get_ms ( void )

2.2.1 呼び出し元

health_get_ms の呼び出し元

2.3 health_thread_func

static void *health_thread_func ( void *arg )

2.3.1 呼び出し元

health_thread_func の呼び出し元

2.3.2 呼び出し先

health_thread_func の呼び出し先

2.4 tcp_health_thread_func

static void *tcp_health_thread_func ( void *arg )

2.4.1 呼び出し元

tcp_health_thread_func の呼び出し元

2.4.2 呼び出し先

tcp_health_thread_func の呼び出し先

2.5 potr_health_thread_start

int potr_health_thread_start ( struct PotrContext_ *ctx )

非 TCP ヘルスチェックスレッドを起動します。

ctx->global.health_interval_ms が 0 の場合は起動しません (POTR_SUCCESS を返します)。

2.5.1 引数

  • ctx [in,out] セッションコンテキストへのポインタ。

2.5.2 戻り値

成功時は POTR_SUCCESS、失敗時は POTR_ERROR を返します。

2.5.3 呼び出し元

potr_health_thread_start の呼び出し元

2.5.4 呼び出し先

potr_health_thread_start の呼び出し先

2.6 potr_health_thread_stop

int potr_health_thread_stop ( struct PotrContext_ *ctx )

非 TCP ヘルスチェックスレッドを停止します。

2.6.1 引数

  • ctx [in,out] セッションコンテキストへのポインタ。

2.6.2 戻り値

成功時は POTR_SUCCESS、失敗時は POTR_ERROR を返します。

2.6.3 呼び出し元

potr_health_thread_stop の呼び出し元

2.7 potr_tcp_health_thread_start

int potr_tcp_health_thread_start ( struct PotrContext_ *ctx, int path_idx )

TCP ヘルスチェックスレッドを path ごとに起動します。

ctx->global.health_interval_ms が 0 の場合は起動しません (POTR_SUCCESS を返します)。

2.7.1 引数

  • ctx [in,out] セッションコンテキストへのポインタ。
  • path_idx [in] パスインデックス (0 ~ n_path-1)。

2.7.2 戻り値

成功時は POTR_SUCCESS、失敗時は POTR_ERROR を返します。

2.7.3 呼び出し元

potr_tcp_health_thread_start の呼び出し元

2.7.4 呼び出し先

potr_tcp_health_thread_start の呼び出し先

2.8 potr_tcp_health_thread_stop

int potr_tcp_health_thread_stop ( struct PotrContext_ *ctx, int path_idx )

TCP ヘルスチェックスレッドを停止します。

2.8.1 引数

  • ctx [in,out] セッションコンテキストへのポインタ。
  • path_idx [in] パスインデックス (0 ~ n_path-1)。

2.8.2 戻り値

成功時は POTR_SUCCESS、失敗時は POTR_ERROR を返します。

2.8.3 呼び出し元

potr_tcp_health_thread_stop の呼び出し元

3 変数

3.1 s_health_args

static HealthArg[POTR_MAX_PATH] s_health_args;

4 定数、マクロ

4.1 POTR_MUTEX_LOCK_LOCAL

#define POTR_MUTEX_LOCK_LOCAL ( m )
    pthread_mutex_lock(m)

4.2 POTR_MUTEX_UNLOCK_LOCAL

#define POTR_MUTEX_UNLOCK_LOCAL ( m )
    pthread_mutex_unlock(m)

5 クラス/構造体

5.1 HealthArg

struct HealthArg {
    struct PotrContext_ *ctx;
    int path_idx;
    int _pad;
}

5.1.1 コラボレーション図

HealthArg のコラボレーション図

5.1.2 属性

5.1.2.1 ctx

struct PotrContext_ *ctx;

5.1.2.2 path_idx

int path_idx;

5.1.2.3 _pad

int _pad;