aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
authorJeff Garzik <[email protected]>2012-09-04 08:53:05 -0700
committerJeff Garzik <[email protected]>2012-09-04 08:53:05 -0700
commit8c7b6c05db007aa8825aa3d366685fcaa9c0be44 (patch)
tree4b1090a9e2dd0ff118af6813a874dfa9991225cc /src/util.cpp
parentMerge pull request #1743 from xanatos/patch-14 (diff)
parentRename CreateThread to NewThread (diff)
downloaddiscoin-8c7b6c05db007aa8825aa3d366685fcaa9c0be44.tar.xz
discoin-8c7b6c05db007aa8825aa3d366685fcaa9c0be44.zip
Merge pull request #1738 from laanwj/2012_08_boostthread
implement CreateThread with boost::thread
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 461f42d17..d1270348e 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -1299,3 +1299,15 @@ void RenameThread(const char* name)
(void)name;
#endif
}
+
+bool NewThread(void(*pfn)(void*), void* parg)
+{
+ try
+ {
+ boost::thread(pfn, parg); // thread detaches when out of scope
+ } catch(boost::thread_resource_error &e) {
+ printf("Error creating thread: %s\n", e.what());
+ return false;
+ }
+ return true;
+}