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);

05-11 03:13