Skip to content

Commit 009b9e3

Browse files
Merge branch '178-doxygen-mutex' into develop
2 parents f9b30c5 + 1484205 commit 009b9e3

File tree

2 files changed

+32
-16
lines changed

2 files changed

+32
-16
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### What it does
22

3-
[![Build Status](https://travis-ci.com/HerbertKoelman/cpp-pthread.svg?branch=master)](https://travis-ci.com/HerbertKoelman/cpp-pthread) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=HerbertKoelman_cpp-pthread&metric=alert_status)](https://sonarcloud.io/dashboard?id=HerbertKoelman_cpp-pthread) [![codecov](https://codecov.io/gh/HerbertKoelman/cpp-pthread/branch/master/graph/badge.svg)](https://codecov.io/gh/HerbertKoelman/cpp-pthread)
3+
[![Build Status](https://travis-ci.com/HerbertKoelman/cpp-pthread.svg?branch=master)](https://travis-ci.com/HerbertKoelman/cpp-pthread) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=HerbertKoelman_cpp-pthread&metric=alert_status)](https://sonarcloud.io/dashboard?id=HerbertKoelman_cpp-pthread) [![codecov](https://codecov.io/gh/HerbertKoelman/cpp-pthread/branch/master/graph/badge.svg)](https://codecov.io/gh/HerbertKoelman/cpp-pthread)
44

55
Some C/C++ compilers are not implementing all of C++11 and above standard, it's often lacking the concurrency features that the standard brings. These compilers will at some point be updated. I was therefore looking for a way to reduce the effort of switching from a specific implementation to the C++11 standard one.
66

include/pthread/mutex.hpp

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,44 +38,60 @@ namespace pthread {
3838
friend class condition_variable;
3939

4040
public:
41-
/**
42-
The mutex object is locked (by calling pthread_mutex_lock). If the mutex is already locked, the calling thread blocks until the mutex becomes
43-
available. This operation returns with the mutex object referenced by mutex in the locked state with the calling thread as its owner.
44-
@throw mutex_exception if error conditions preventing this method to succeed.
41+
/** Lock the mutex.
42+
*
43+
* The mutex object is locked (by calling pthread_mutex_lock). If the mutex is already locked, the calling thread blocks until the mutex becomes
44+
* available. This operation returns with the mutex object referenced by mutex in the locked state with the calling thread as its owner.
45+
*
46+
* @throw mutex_exception if error conditions preventing this method to succeed.
47+
* @see unlock
48+
* @see pthread_mutex_lock
4549
*/
4650
void lock();
4751

48-
/**
52+
/** Try to lock the mutex.
53+
*
4954
* Identical to lock method except that if the mutex object is currently locked (by any thread, including the
5055
* current thread), the call returns immediately.
5156
*
5257
* @return true if the mutex is locked, false is returned if the lock is held by some other thread.
5358
* @throw mutex_exception if error conditions preventing this method to succeed.
5459
* @see lock
5560
* @see unlock
61+
* @see pthread_mutex_trylock
5662
*/
5763
bool try_lock();
5864

59-
/**
60-
The pthread_mutex_unlock function releases the mutex object referenced by mutex. The manner in which a mutex is released is dependent upon the mutex's type attribute. If there are threads blocked on the mutex object referenced by mutex when unlock is called, resulting in the mutex becoming available, the scheduling policy is used to determine which thread shall acquire the mutex.
61-
@throw mutex_exception if error conditions preventing this method to succeed.
65+
/** Release the mutex.
66+
*
67+
* Releases the mutex object referenced by mutex. The manner in which a mutex is released is dependent upon the mutex's
68+
* type attribute. If there are threads blocked on the mutex object referenced by mutex when unlock is called,
69+
* resulting in the mutex becoming available, the scheduling policy is used to determine which thread shall acquire the mutex.
70+
*
71+
* @throw mutex_exception if error conditions preventing this method to succeed.
72+
* @see pthread_mutex_unlock
6273
*/
6374
void unlock();
6475

65-
/**
66-
Constructor/Desctructor
67-
@throw mutex_exception if error conditions preventing this method to succeed.
76+
/** create and initialize a mutex.
77+
*
78+
* > *WARN* the default mutex attributes are used.
79+
*
80+
* @throw mutex_exception if error conditions preventing this method to succeed.
81+
* @see pthread_mutex_init
6882
*/
6983
mutex();
7084

85+
/** destroys the mutex.
86+
*
87+
* @see pthread_mutex_destroy
88+
*/
89+
virtual ~mutex();
90+
7191
/** not copy-assignable, so no copy contructor is needed.
7292
*
7393
*/
7494
mutex(const mutex &) = delete;
75-
/**
76-
* destroys the mutes (pthread_mutex_destroy)
77-
*/
78-
virtual ~mutex();
7995

8096
/** not copy-assignable
8197
*

0 commit comments

Comments
 (0)