Skip to content

Commit 3a0847d

Browse files
refs #149 @1h
1 parent e8e50d6 commit 3a0847d

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

src/pthread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
namespace pthread {
1616

17-
extern "C" const char *cpp_pthread_version(){
17+
const char *cpp_pthread_version(){
1818
#ifndef CPP_PTHREAD_VERSION
1919
return "missing CPP_PTHREAD_VERSION define. Re-run configure" ;
2020
#else

src/read_write_lock.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ namespace pthread {
88
int ret = pthread_rwlock_wrlock(&_rwlock);
99
if ( ret != 0 ){
1010
throw read_write_lock_exception("Try get write lock failed.", ret);
11-
};
11+
}
1212
}
1313

1414
void write_lock::try_lock (){
1515
int ret = pthread_rwlock_trywrlock(&_rwlock);
1616
if ( ret != 0 ){
1717
throw read_write_lock_exception("Try get write lock failed.", ret);
18-
};
18+
}
1919
}
2020

2121
write_lock::write_lock (){//:read_lock(){

src/thread.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ namespace pthread {
7373
return rc;
7474
}
7575

76-
thread::thread(): _status(thread_status::not_a_thread), _thread(0){
76+
thread::thread(): _thread(0), _status(thread_status::not_a_thread) {
7777

7878
// intentional..
7979
}
@@ -129,7 +129,7 @@ namespace pthread {
129129
std::swap(_status, other._status);
130130
}
131131

132-
abstract_thread::abstract_thread(const std::size_t stack_size): _stack_size(stack_size), _thread(NULL){
132+
abstract_thread::abstract_thread(const std::size_t stack_size): _thread(NULL), _stack_size(stack_size){
133133
}
134134

135135
abstract_thread::~abstract_thread(){
@@ -179,7 +179,7 @@ namespace pthread {
179179
printf("thread_group destructor failed to join one thread. %s, (%d) %s.\n", err.what(), err.pthread_errno(), err.pthread_errmsg());
180180
} catch ( ... ){ //NOSONAR this was done on purpose to avoid crashes due to unhandled error conditions. This should never happen.
181181
printf("thread_group destructor received an unexpected exception when joining threads.");
182-
};
182+
}
183183
}
184184
}
185185
}
@@ -208,11 +208,16 @@ namespace pthread {
208208
}
209209

210210
/**
211-
This function is a helper function. It has normal C linkage, and is
212-
the base for newly created Thread objects. It runs the
213-
run method on the thread object passed to it (as a void *).
211+
* This function is a helper function. It has normal C linkage, and is
212+
* the base for newly created Thread objects. It runs the
213+
* run method on the thread object passed to it (as a void *).
214+
*
215+
* This is the signature that the POSIX threading library imposes.
216+
*
217+
* @param runner runnable interface.
218+
* @return unknown
214219
*/
215-
void *thread_startup_runnable(void *runner) {
220+
void *thread_startup_runnable(void *runner) { // NOSONAR
216221

217222
try{
218223
static_cast<runnable *>(runner)->run();

0 commit comments

Comments
 (0)