|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r74110 - trunk/boost/interprocess/detail
From: igaztanaga_at_[hidden]
Date: 2011-08-28 14:30:28
Author: igaztanaga
Date: 2011-08-28 14:30:28 EDT (Sun, 28 Aug 2011)
New Revision: 74110
URL: http://svn.boost.org/trac/boost/changeset/74110
Log:
Added SwitchToThread to sched_yield to improve a bit process hand-offs
Text files modified:
trunk/boost/interprocess/detail/win32_api.hpp | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
Modified: trunk/boost/interprocess/detail/win32_api.hpp
==============================================================================
--- trunk/boost/interprocess/detail/win32_api.hpp (original)
+++ trunk/boost/interprocess/detail/win32_api.hpp 2011-08-28 14:30:28 EDT (Sun, 28 Aug 2011)
@@ -790,6 +790,7 @@
, interprocess_filetime *lpExitTime,interprocess_filetime *lpKernelTime
, interprocess_filetime *lpUserTime );
extern "C" __declspec(dllimport) void __stdcall Sleep(unsigned long);
+extern "C" __declspec(dllimport) int __stdcall SwitchToThread();
extern "C" __declspec(dllimport) unsigned long __stdcall GetLastError();
extern "C" __declspec(dllimport) void __stdcall SetLastError(unsigned long);
extern "C" __declspec(dllimport) void * __stdcall GetCurrentProcess();
@@ -921,7 +922,11 @@
{ return ((((unsigned short)(s)) << 10) | (unsigned short)(p)); }
inline void sched_yield()
-{ Sleep(1); }
+{
+ if(!SwitchToThread()){
+ Sleep(1);
+ }
+}
inline unsigned long get_current_thread_id()
{ return GetCurrentThreadId(); }
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk