From owner-freebsd-hackers Thu Jul 19 9:43:29 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.39]) by hub.freebsd.org (Postfix) with SMTP id 8DCA437B401 for ; Thu, 19 Jul 2001 09:43:25 -0700 (PDT) (envelope-from roam@orbitel.bg) Received: (qmail 17139 invoked by uid 1000); 19 Jul 2001 16:47:35 -0000 Date: Thu, 19 Jul 2001 19:47:35 +0300 From: Peter Pentchev To: Louis-Philippe Gagnon Cc: tlambert2@mindspring.com, freebsd-hackers@FreeBSD.ORG Subject: Re: flock/pthread bug? Message-ID: <20010719194735.D10583@ringworld.oblivion.bg> Mail-Followup-To: Louis-Philippe Gagnon , tlambert2@mindspring.com, freebsd-hackers@FreeBSD.ORG References: <1fbd01c10fba$499834d0$2964a8c0@macadamian.com> <3B5690A1.8EDD0812@mindspring.com> <203501c11059$35755420$2964a8c0@macadamian.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <203501c11059$35755420$2964a8c0@macadamian.com>; from louisphilippe@macadamian.com on Thu, Jul 19, 2001 at 09:46:27AM -0400 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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" [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