长风破浪会有时,直挂云帆济沧海

Dream Word

博客园 首页 新随笔 联系 订阅 管理

pthead_mutex_t mutex;

1:create:

  pthread_mutex_init(pthread_mutex_t* mutex, const pthread_mutexattr_t* attr);

2:destroy:

  pthread_mutex_destory(pthread_mutex_t* mutex);

3:lock:

  pthread_mutex_lock(pthread_mutex* mutex);

4:lock not block

  pthread_mutx_trylock(pthread_mutex* mutex);

  if(pthread_mutex_trylock(&mutex)==0)

  {

    //lock success

  }

  else

  {

  }

5:unlock:

  pthread_mutex_unlock(pthread_mutex_t* mutex);

posted on 2018-03-18 20:46  长风II  阅读(211)  评论(0编辑  收藏  举报