sol_mutex.h

来自「This software was done in part for a tex」· C头文件 代码 · 共 35 行

H
35
字号
// class for mutual exclusion using the solaris thread library #include <thread.h>#include <errno.h>class leda_mutex {  leda_mutex(const leda_mutex& m) { mutex_init(&lock_, 0, NULL); }   leda_mutex operator=(const leda_mutex& m)   { mutex_init (&lock_, 0, NULL); return *this; }public:  leda_mutex() { mutex_init (&lock_, 0 , NULL); } ~leda_mutex() { mutex_destroy (&lock_); }  void acquire() { mutex_lock (&lock_); }  void lock()    { mutex_lock (&lock_); }  void enter()   { mutex_lock (&lock_); }  void release() { mutex_unlock (&lock_); }  void unlock()  { mutex_unlock (&lock_); }  void exit()    { mutex_unlock (&lock_); }  int trylock()  { return mutex_trylock (&lock_); }  int tryenter() { return mutex_trylock (&lock_); }  private:  mutex_t lock_;}; 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?