diff options
| author | Wladimir J. van der Laan <[email protected]> | 2012-08-28 18:26:35 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2012-08-29 20:02:07 +0200 |
| commit | 61d85071405b99c3734606eed31ea8f615c0c77a (patch) | |
| tree | 6dfa3d0372bc7cb4751da7a70d2fd674a39ca315 /src/util.cpp | |
| parent | Merge pull request #1754 from laanwj/2012_08_stringsupdate2 (diff) | |
| download | discoin-61d85071405b99c3734606eed31ea8f615c0c77a.tar.xz discoin-61d85071405b99c3734606eed31ea8f615c0c77a.zip | |
implement CreateThread with boost::thread
I'm not sure why this wasn't done before.
- Removes typedef of pthread_t on Windows, which fixes a native compile issue on mingw.
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..ec24ee403 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1299,3 +1299,15 @@ void RenameThread(const char* name) (void)name; #endif } + +bool CreateThread(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; +} |