⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 posix.h

📁 A Library of Efficient Data Types and Algorithms,封装了常用的ADT及其相关算法的软件包
💻 H
字号:
/*******************************************************************************++  LEDA 4.5  +++  posix.h+++  Copyright (c) 1995-2004+  by Algorithmic Solutions Software GmbH+  All rights reserved.+ *******************************************************************************/// $Revision: 1.3 $  $Date: 2004/02/06 11:20:29 $// class for mutual exclusion using the posix thread library #define LEDA_STD_INCLUDE#include <pthread.h>#undef LEDA_STD_INCLUDE#include <LEDA/std/errno.h>LEDA_BEGIN_NAMESPACEinline int get_thread_id() { return (int)pthread_self(); }class leda_mutex {  leda_mutex(const leda_mutex& m) { pthread_mutex_init (&lock_, NULL); }   leda_mutex operator=(const leda_mutex& m)   { pthread_mutex_init (&lock_, NULL); return *this; }public:  leda_mutex() { pthread_mutex_init (&lock_, NULL); } ~leda_mutex() { pthread_mutex_destroy (&lock_); }  void acquire() { pthread_mutex_lock (&lock_); }  void lock()    { pthread_mutex_lock (&lock_); }  void enter()   { pthread_mutex_lock (&lock_); }  void release() { pthread_mutex_unlock (&lock_); }  void unlock()  { pthread_mutex_unlock (&lock_); }  void exit()    { pthread_mutex_unlock (&lock_); }  int trylock()  { return pthread_mutex_trylock (&lock_); }  int tryenter() { return pthread_mutex_trylock (&lock_); }  private:  pthread_mutex_t lock_;}; LEDA_END_NAMESPACE

⌨️ 快捷键说明

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