wait and notify in C/C++ shared memory

前端 未结 6 810
旧巷少年郎
旧巷少年郎 2020-12-13 04:21

How to wait and notify like in Java In C/C++ for shared memory between two or more thread?I use pthread library.

6条回答
  •  感动是毒
    2020-12-13 04:42

    Using Condition Variables is one way to do it: those are available when using the pthread library under Linux (see link).

    A condition variable is a variable of type pthread_cond_t and is used with the appropriate functions for waiting and later, process continuation.

提交回复
热议问题