acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
mutex.h
1#pragma once
2#undef ACME_MUTEX_DEBUG
3
4class CLASS_DECL_ACME mutex :
5 virtual public particle
6{
7public:
8
9#ifdef ACME_MUTEX_DEBUG
10 string m_strThread;
11 itask m_itask;
12#endif
13
14//#if !defined(WINDOWS)
15//
16// pthread_mutex_t m_pmutex;
17// string m_strName;
18//
19//#ifdef MUTEX_COND_TIMED
20//
21// pthread_cond_t m_cond;
22//
23//#endif
24//
25//#if defined(MUTEX_COND_TIMED) || defined(MUTEX_NAMED_FD)
26//
27// pthread_t m_thread;
28// ::i32 m_count;
29//
30//#endif
31//
32//#if defined(MUTEX_NAMED_POSIX)
33//
34// sem_t * m_psem; // as of 2016-11-26
35// // not implemented (err=38) on android-19
36//#elif defined(MUTEX_NAMED_FD)
37//
38// ::i32 m_iFd;
39//
40//#elif defined(MUTEX_NAMED_VSEM)
41//
42// key_t m_key;
43// ::i32 m_semid;
44//
45//#endif
46//
47//#endif
48
49 //bool m_bAlreadyExists;
50
51
52//#ifdef WINDOWS
53 //mutex(enum_create_new ecreatenew, const_char_pointer pstrName, void * posdata, bool bOwner = true);
54//#elif defined(MUTEX_NAMED_POSIX)
55// mutex(enum_create_new ecreatenew = create_new, const ::scoped_string & scopedstr = nullptr, const_char_pointer pstrName,sem_t * psem,bool bOwner = true);
56//#elif defined(MUTEX_NAMED_FD)
57// mutex(enum_create_new ecreatenew, const_char_pointer pstrName, ::i32 iFd, bool bOwner = true);
58//#elif defined(MUTEX_NAMED_VSEM)
59// mutex(enum_create_new ecreatenew, const_char_pointer pstrName,key_t key, ::i32 semid, bool bOwner = true);
60//#endif
61 //mutex(::particle * pparticle, bool bInitiallyOwn, const_char_pointer pszName ARG_SEC_ATTRS_DEF);
62 //mutex(enum_create_new ecreatenew = e_create_new, bool bInitiallyOwn = false);
63 mutex();
64 ~mutex() override;
65
66
67//#ifndef WINDOWS
68//
69// //virtual ::e_status lock() override;
70//
71// //virtual ::e_status lock(const class time & timeWait) override;
72//
73// virtual void _wait() override;
74//
75// virtual bool _wait(const class time & timeWait) override;
76//
77//#endif
78
79 using particle::unlock;
80 void unlock() override = 0;
81
82 //virtual bool already_exists();
83
84
86
87
88};
89
90
91CLASS_DECL_ACME void wait_until_mutex_does_not_exist(const_char_pointer pszName);
92
93
94
95CLASS_DECL_ACME ::pointer< ::mutex > get_ui_destroyed_mutex();
96
97
Definition types.h:93