誰かが次のようなものを使用したことがあるかどうか、私は興味があります:
pthread_mutex_lock(&ctx->processing_pipeline.feeder_safe_point_mutex);
while(!ctx->processing_pipeline.feeder_safe_point)
pthread_cond_wait(&ctx->processing_pipeline.feeder_safe_point_cv, &ctx->processing_pipeline.feeder_safe_point_mutex);
pthread_mutex_unlock(&ctx->processing_pipeline.feeder_safe_point_mutex);
...コンドバーを待っているとき。
アイデアは、イベントが完了したときfeeder_safe_point
int
に変数が設定され1
、待機中のスレッドが起動されるというものです。
また、condvars を使用して複数のスレッドの実行をシリアル化するための推奨される方法は何ですか