📄 solaris.h
字号:
/*******************************************************************************++ LEDA 4.5 +++ solaris.h+++ Copyright (c) 1995-2004+ by Algorithmic Solutions Software GmbH+ All rights reserved.+ *******************************************************************************/// $Revision: 1.3 $ $Date: 2004/02/06 11:20:31 $// class for mutual exclusion using the solaris thread library #define LEDA_STD_INCLUDE#include <thread.h>#undef LEDA_STD_INCLUDE#include <LEDA/std/errno.h>LEDA_BEGIN_NAMESPACEinline int get_thread_id() { return (int)thr_self(); }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_;}; LEDA_END_NAMESPACE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -