boostorg / boostorg/interprocess
named_condition_any does not appear to notify
- Lenguaje dominante
- C++
- Estrellas
- 185
- Forks
- 131
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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.
```c++
#include
#include
#include
#include
#include
#include
#include
#include
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 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;
}
```
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Comience con el reproductor y compílelo en Linux contra Boost 1.68.0. Compare el comportamiento y las rutas de implementación de boost/interprocess/sync/named_condition_any.hpp y named_condition.hpp, y verifique después que el proceso hijo recibe notificaciones cuando se usa named_condition_any, incluidas las esperas temporizadas.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- cpp
- Área
- operating-systems
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100