Date: Thu, 19 Jul 2001 19:47:35 +0300 From: Peter Pentchev <roam@orbitel.bg> To: Louis-Philippe Gagnon <louisphilippe@macadamian.com> Cc: tlambert2@mindspring.com, freebsd-hackers@FreeBSD.ORG Subject: Re: flock/pthread bug? Message-ID: <20010719194735.D10583@ringworld.oblivion.bg> In-Reply-To: <203501c11059$35755420$2964a8c0@macadamian.com>; from louisphilippe@macadamian.com on Thu, Jul 19, 2001 at 09:46:27AM -0400 References: <Pine.BSF.4.21.0107181320030.94740-100000@InterJet.elischer.org> <1fbd01c10fba$499834d0$2964a8c0@macadamian.com> <3B5690A1.8EDD0812@mindspring.com> <203501c11059$35755420$2964a8c0@macadamian.com>
index | next in thread | previous in thread | raw e-mail
On Thu, Jul 19, 2001 at 09:46:27AM -0400, Louis-Philippe Gagnon wrote:
> Lots of ideas to try (esp. since I don't need FIFO); thanks!
>
> LPG
>
> ----- Original Message -----
> From: "Terry Lambert" <tlambert2@mindspring.com>
[snip]
> > To wrap either, you would need to:
> >
> > retry:
> > st = try_non_blocking_get();
> > if (st == FAIL) {
> > yield();
> > goto retry;
> > }
> >
> > Note that the "yield" system call is non-standard, and you
> > will buzz-loop somewhat, depressing your priority. You
> > will also have a race window, subject to the "thundering
> > herd" problem. You could put a "sleep(1);" in place of
> > the "yield();" call... this would eliminate the buzzing
> > (somewhat), but would widen the race window.
I don't know if Terry was talking about the sched_yield() syscall,
but if he was, then sched_yield(2) exists, at least in 4.x, and is
documented as POSIX-compliant.
G'luck,
Peter
--
"yields falsehood, when appended to its quotation." yields falsehood, when appended to its quotation.
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010719194735.D10583>
