Articles in the pthread category

  1. "[Pthread] Run Two Threads in Turn"

    Pthread Interfaces

    #include <pthread.h>
    int pthread_create(pthread_t *tidp,
                       const pthread_attr_t attr,
               void *(*start_rtn)(void *),
               void *arg);
    int pthread_join(pthread_t *tidp, void **rval_ptr);
    int pthread_mutex_lock(pthread_mutex_t *mutex);
    int pthread_mutex_unlock(pthread_mutex_t *mutex);
    int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
    int pthread_cond_signal(pthread_cond_t *cond);
    

    Precautions of pthread_cond_wait()

    • pthread_cond_wait() accepts two arguments: 'cond' and …