public inbox for
 help / color / mirror / Atom feed
From: Virgilio Alexandre Fornazin <>
Subject: patch for sched_yield()
Date: Wed, 22 Aug 2007 23:17:00 -0000	[thread overview]
Message-ID: <> (raw)


I did a change in sched_yield() to support
multi-processor systems after checking the OS (NT
style oses). I managed to compile it under VS2005 SP1.
I'm putting the code here to share with pthreads

I changed the implementation from:

  Sleep (0);

  return 0;


  static OSVERSIONINFO vs = {0};

  if (vs.dwOSVersionInfoSize == 0)
    vs.dwOSVersionInfoSize = sizeof(vs);

  if (vs.dwPlatformId == VER_PLATFORM_WIN32_NT)
    SwitchToThread ();
    Sleep (0);

  return 0;

I saw in another mailing list that Sleep(0) sometimes
doesn't yield the thread and performs nothing on some
Windows versions.

I hope this help somebody and could be integrated to
main code after more testing with other cpu/configurations.

      Flickr agora em português. Você clica, todo mundo vê.

             reply	other threads:[~2007-08-22 20:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-22 23:17 Virgilio Alexandre Fornazin [this message]
2007-09-29 22:29 ` Bossom, John

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).