Skip to content

Commit 260a954

Browse files
author
Herbert Koelman
committed
scribbles
1 parent 8d93ab5 commit 260a954

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

include/ibm.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// More here http://www.ibm.com/support/knowledgecenter/SSGH3R_13.1.2/com.ibm.xlcpp131.aix.doc/proguide/rvaluereferences.html
44
//
55

6-
//#ifdef __IBMCPP__
6+
#ifdef __IBMCPP__
77

88
namespace ibm {
99
template <typename T> struct remove_reference {
@@ -43,4 +43,4 @@ namespace ibm {
4343
return static_cast<typename remove_reference<T>::type &&>(t);
4444
}
4545
}
46-
//#endif
46+
#endif

tests/without-cpp11-pthread-tests.cpp

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -76,28 +76,30 @@ int main(int argc, const char * argv[]) {
7676
std::auto_ptr<pthread::thread> pt0(new pthread::thread(w));
7777
pt0->join();
7878

79-
std::list<std::auto_ptr<pthread::thread>> threads;
79+
// std::list<std::auto_ptr<pthread::thread>> threads;
80+
std::list<pthread::thread> threads;
8081
for (auto x = 20 ; x > 0 ; x--){
81-
threads.push_back(std::auto_ptr<pthread::thread>(new pthread::thread(w)));
82+
// threads.push_back(std::auto_ptr<pthread::thread>(new pthread::thread(w)));
83+
threads.push_back(ibm::move(pthread::thread(w)));
8284
}
8385
// threads.push_back(pthread::thread(w));
8486
// threads.push_back(pthread::thread(w));
8587
// threads.push_back(pthread::thread(w));
8688
// threads.push_back(pthread::thread(worker("herbert's worker")));
87-
88-
message("increment counter");
89-
for ( auto x = 20000 ; x > 0 ; x--){
90-
pthread::lock_guard<pthread::mutex> lck(mtx);
91-
counter++ ;
92-
condition.notify_one();
93-
}
94-
message("main is waiting for threads to finish");
95-
96-
std::list<std::auto_ptr<pthread::thread>>::iterator iterator;
97-
for(iterator = threads.begin(); iterator != threads.end(); iterator++){
98-
message("join a thread (loop)");
99-
(*iterator)->join();
100-
}
89+
//
90+
// message("increment counter");
91+
// for ( auto x = 20000 ; x > 0 ; x--){
92+
// pthread::lock_guard<pthread::mutex> lck(mtx);
93+
// counter++ ;
94+
// condition.notify_one();
95+
// }
96+
// message("main is waiting for threads to finish");
97+
//
98+
// std::list<std::auto_ptr<pthread::thread>>::iterator iterator;
99+
// for(iterator = threads.begin(); iterator != threads.end(); iterator++){
100+
// message("join a thread (loop)");
101+
// (*iterator)->join();
102+
// }
101103

102104
message( "end reached");
103105

0 commit comments

Comments
 (0)