← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2130: shuffle around yield/fastcritsection sleeps

 

------------------------------------------------------------
revno: 2130
committer: cologic <ne5@xxxxxxxxxxx>
branch nick: dcplusplus
timestamp: Fri 2010-04-23 14:32:11 -0400
message:
  shuffle around yield/fastcritsection sleeps
modified:
  dcpp/CriticalSection.h
  dcpp/Thread.h


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dcpp/CriticalSection.h'
--- dcpp/CriticalSection.h	2010-02-11 21:44:13 +0000
+++ dcpp/CriticalSection.h	2010-04-23 18:32:11 +0000
@@ -83,7 +83,7 @@
 
 	void enter() {
 		while(Thread::safeExchange(state, 1) == 1) {
-			Thread::yield();
+			Thread::sleep(1);
 		}
 	}
 	void leave() {

=== modified file 'dcpp/Thread.h'
--- dcpp/Thread.h	2010-02-11 21:44:13 +0000
+++ dcpp/Thread.h	2010-04-23 18:32:11 +0000
@@ -62,7 +62,7 @@
 	void setThreadPriority(Priority p) throw() { ::SetThreadPriority(threadHandle, p); }
 
 	static void sleep(uint32_t millis) { ::Sleep(millis); }
-	static void yield() { ::Sleep(1); }
+	static void yield() { ::Sleep(0); }
 
 #ifdef __MINGW32__
 	static long safeInc(volatile long& v) { return InterlockedIncrement((long*)&v); }