diff options
| author | Jeff Garzik <[email protected]> | 2012-09-04 08:53:05 -0700 |
|---|---|---|
| committer | Jeff Garzik <[email protected]> | 2012-09-04 08:53:05 -0700 |
| commit | 8c7b6c05db007aa8825aa3d366685fcaa9c0be44 (patch) | |
| tree | 4b1090a9e2dd0ff118af6813a874dfa9991225cc /src/util.cpp | |
| parent | Merge pull request #1743 from xanatos/patch-14 (diff) | |
| parent | Rename CreateThread to NewThread (diff) | |
| download | discoin-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.cpp | 12 |
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; +} |