I think I've seen such a variable elsewhere in Phobos. Walter?

Andrei

On 9/5/10 15:46 CDT, David Simcha wrote:
Good point.  I guess maybe a shared static this statement that
initializes an immutable variable to either 0 or 1?

On 9/5/2010 4:07 PM, Brad Roberts wrote:
It probably shouldn't be done via a version statement as that's purely
a compile
time decisions. Runtime would allow apps to choose behavior based on
where they
run.

On 9/5/2010 11:40 AM, David Simcha wrote:
Seems like a no-brainer to me. We're basically talking about getting
rid of
workarounds for problems on platforms where the original problem
doesn't exist.
Thanks for noticing/taking care of this.

On 9/5/2010 12:17 PM, SK wrote:
Hello,
Core.thread.yield call has a performance hobbling work-around for
scheduler problems in Windws XP and earlier:

/**
* Forces a context switch to occur away from the calling thread.
*/
static void yield()
{
version( Windows )
{
// NOTE: Sleep(1) is necessary because Sleep(0) does not give
// lower priority threads any timeslice, so looping on
// Sleep(0) could be resource-intensive in some cases.
Sleep( 1 );
}
else version( Posix )
{
sched_yield();
}
}


Microsoft fortunately fixed the problem for new versions of Windows,
starting with Windows Server 2003 as described here:
http://msdn.microsoft.com/en-us/library/ms686298%28VS.85%29.aspx

On Windows 7:
Sleep(1), the workaround, allows only 1000 thread yields per second
per core, which is agonizingly slow.
Sleep(0) allows 4.7 Million yields per second per core on my 2.6GHz
machine.

Any objection to changing to Sleep(0) for Windows 2003 and above?
What definition is suitable for use in version() to make this
distinction?

Regards,
-steve
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos


_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to