From 61d85071405b99c3734606eed31ea8f615c0c77a Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 28 Aug 2012 18:26:35 +0200 Subject: 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. --- src/util.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/util.cpp') 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; +} -- cgit v1.2.3 From 4d1d94c56cf60e22e9199f8c37c5634752b570f5 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 29 Aug 2012 20:25:37 +0200 Subject: Rename CreateThread to NewThread Prevent clash with win32 API symbol --- src/util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/util.cpp') diff --git a/src/util.cpp b/src/util.cpp index ec24ee403..d1270348e 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1300,7 +1300,7 @@ void RenameThread(const char* name) #endif } -bool CreateThread(void(*pfn)(void*), void* parg) +bool NewThread(void(*pfn)(void*), void* parg) { try { -- cgit v1.2.3