pthread condition variables on Linux, odd behaviour

前端 未结 4 842
情深已故
情深已故 2021-01-20 01:49

I\'m synchronizing reader and writer processes on Linux.

I have 0 or more process (the readers) that need to sleep until they are woken up, read a resource, go back

4条回答
  •  野的像风
    2021-01-20 02:32

    Have you set the PTHREAD_PROCESS_SHARED attribute on both your condvar and mutex?

    For Linux consult the following man pages:

    • pthread_mutexattr_init (with sample)
    • pthread_mutexattr_setpshared
    • pthread_condattr_init
    • pthread_condattr_setpshared

    Methods, types, constants etc. are normally defined in /usr/include/pthread.h, /usr/include/nptl/pthread.h.

提交回复
热议问题