Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

named_condition_any does not appear to notify

オープン
#73 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
cpp

調査の方向性

reproducer から始め、Linux 上で Boost 1.68.0 に対してコンパイルしてください。boost/interprocess/sync/named_condition_any.hpp と named_condition.hpp の動作および実装パスを比較し、その後、named_condition_any を使用した場合に、タイムアウト付きの待機を含めて子プロセスが通知を受け取ることを確認してください。

索引モデルが issue の本文から書いたものです。

説明

I haven't been able to get named_condition_any objects to work on Linux with Boost 1.68.0. Below is code to replicate. When using a named_condition_any the child process will never receive the notification, when using just a named_condition the child process receives the notifications.

#include <boost/interprocess/sync/named_condition_any.hpp>
#include <boost/interprocess/sync/named_condition.hpp>
#include <boost/interprocess/sync/named_mutex.hpp>
#include <boost/thread/thread_time.hpp>

#include <unistd.h>

#include <chrono>
#include <thread>
#include <iostream>

namespace ip = boost::interprocess;

int main()
{
    typedef ip::named_mutex mutex_type;
    //typedef ip::named_condition condition_type;
    typedef ip::named_condition_any condition_type;

    mutex_type::remove("test_mutex");
    condition_type::remove("test_condition");

    pid_t pid = fork();
    if(pid == 0)
    { // parent process
        mutex_type mutex(ip::open_or_create, "test_mutex");
        condition_type condition(ip::open_or_create, "test_condition");

        while(true)
        {
            std::this_thread::sleep_for(std::chrono::seconds(1));
            std::cout << "signaling children" << std::endl;
            condition.notify_all();
        }
    }
    else if(pid > 0)
    { // child process
        mutex_type mutex(ip::open_or_create, "test_mutex");
        condition_type condition(ip::open_or_create, "test_condition");
        
        while(true)
        {
            boost::posix_time::ptime wait_time(boost::get_system_time() +
                boost::posix_time::seconds(10));
            ip::scoped_lock<ip::named_mutex> lock(mutex);
            if(condition.timed_wait(lock, wait_time))
                std::cout << "got signal from parent" << std::endl;
            else
                std::cout << "timeout" << std::endl;
        }
    }
    else
    {
        std::cout << "failed to fork: " << pid << std::endl;
        return 1;
    }

    return 0;
}
主要言語
C++
スター
185
フォーク
131
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

boostorg/interprocess のほかの issue

boostorg/interprocess の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。