Skip to content

Commit 40f1faa

Browse files
refs #65
- runs on Mac OS X (used command line to check, not XCode) - read_lock contructor moved from public to protected . This will avoid the accidental creation of a read_lock (which makes no sense).
1 parent cba9b00 commit 40f1faa

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

include/pthread/read_write_lock.hpp

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ namespace pthread {
2424
* @{
2525
*/
2626

27-
/** This class acquires the read lock
27+
/** This class acquires the read lock.
28+
*
29+
* This class cannot be instaiated as it's main putpose is to implement read locks. To use a read lock create
30+
* either a read_write_lock or a write_lock.
2831
*
2932
* @author herbert koelman ([email protected])
3033
* @since v1.6.0
34+
* @see pthread::read_write_lock
3135
*/
3236
class read_lock {
3337
public:
@@ -50,24 +54,25 @@ namespace pthread {
5054
@throw read_write_lock_exception if error conditions preventing this method to succeed.
5155
*/
5256
void unlock ();
53-
54-
/**
55-
Constructor/Desctructor
56-
57-
this constructor shall allocate any resources required to use the read-write lock referenced by rwlock and initializes the lock to an unlocked state. The read/write lock
58-
passes NULL attributes. This means default behavior.
59-
60-
@throw read_write_lock_exception if error conditions preventing this method to succeed.
61-
*/
62-
read_lock ();
57+
6358

6459
/**
6560
* the descructor, shall destroy the read-write lock object referenced by rwlock and release any resources used by the lock.
6661
*/
6762
virtual ~read_lock ();
6863

6964
protected:
70-
65+
66+
/**
67+
Constructor/Desctructor
68+
69+
this constructor shall allocate any resources required to use the read-write lock referenced by rwlock and initializes the lock to an unlocked state. The read/write lock
70+
passes NULL attributes. This means default behavior.
71+
72+
@throw read_write_lock_exception if error conditions preventing this method to succeed.
73+
*/
74+
read_lock ();
75+
7176
/** read/write lock reference */
7277
pthread_rwlock_t _rwlock;
7378
};

tests/synchronized_queue_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class consumer : public status, public pthread::abstract_thread {
118118
#endif
119119
printf ("starting consumer\n");
120120
message_ptr pmessage ; // (new message("hello"));
121-
printf("queue max size is %d\n", _queue.max_size());
121+
printf("queue max size is %zu\n", _queue.max_size());
122122
while( running() ){
123123

124124
try{

0 commit comments

Comments
 (0)