YSTest: Mutex.h 源文件

YSTest PreAlpha_b700_20160611 The YSLib Test Project

- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件

- 文件列表
- 文件成员

Mutex.h
浏览该文件的文档.
1 /*
2 © 2014-2016 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #ifndef YCL_INC_Mutex_h_
29 #define YCL_INC_Mutex_h_ 1
30
31 #include "YModules.h"
32 #include YFM_YCLib_YCommon
33 #if YF_Multithread == 1
34 # include <ystdex/concurrency.h>
35 # define YCL_Mutex_Namespace std
36 # define YCL_Threading_Namespace ystdex
37 #else
38 # include <ystdex/pseudo_mutex.h>
39 # define YCL_Mutex_Namespace ystdex::single_thread
40 # define YCL_Threading_Namespace ystdex::threading
41 #endif
42
43 namespace platform
44 {
45
47 namespace Concurrency
48 {
49
50 using YCL_Mutex_Namespace::mutex;
51 using YCL_Mutex_Namespace::recursive_mutex;
52 // TODO: Check %_GTHREAD_USE_MUTEX_TIMEDLOCK defined or %YCL_*.
53 //using YCL_Mutex_Namespace::timed_mutex;
54 //using YCL_Mutex_Namespace::recursive_timed_mutex;
55
56 using YCL_Mutex_Namespace::lock_guard;
57 using YCL_Mutex_Namespace::unique_lock;
58
59 using YCL_Mutex_Namespace::lock;
60 using YCL_Mutex_Namespace::try_lock;
61
63 using YCL_Mutex_Namespace::once_flag;
65 using YCL_Mutex_Namespace::call_once;
66
67 } // namespace Concurrency;
68
70 namespace Threading
71 {
72
74 using YCL_Threading_Namespace::unlock_delete;
75 using YCL_Threading_Namespace::locked_ptr;
76
77 } // namespace Threading;
78
79 } // namespace platform;
80
81 #undef YCL_Threading_Namespace
82 #undef YCL_Mutex_Namespace
83
84 #endif
85
ystdex::single_thread::try_lock
int try_lock(_tLock1 &&, _tLock2 &&, _tLocks &&...)
Definition: pseudo_mutex.h:563
pseudo_mutex.h
伪互斥量。
ystdex::single_thread::call_once
void call_once(once_flag &flag, _fCallable &&f, _tParams &&...args)
按标识调用函数，保证调用一次。
Definition: pseudo_mutex.h:537
platform
默认平台命名空间。
Definition: Container.h:47
concurrency.h
并发操作。
YModules.h
ystdex::unlock_delete
threading::unlock_delete< _tMutex, _tLock > unlock_delete
解锁删除器：默认使用标准库互斥量和锁。
Definition: concurrency.h:52
ystdex::locked_ptr
threading::locked_ptr< _type, _tMutex, _tLock > locked_ptr
独占所有权的锁定指针：默认使用标准库互斥量和锁。
Definition: concurrency.h:62
ystdex::single_thread::lock
void lock(_tLock1 &&, _tLock2 &&, _tLocks &&...)
Definition: pseudo_mutex.h:558