🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #9283

Re: Sleep() doesn't work as I'd expect

#9283
From: Chris Phillips
Date: Tue, 13 Jul 2004 07:40
15 lines
1849 bytes
> There should be a way around that.
> In my experience, a circular buffer has 2 pointers, In and Out.
>
> The Writer reads In and Out.  If In == Out-1 (don't forget to account
> for wrap), buffer overflow.
> Otherwise writes to buffer[In], writes In=(In+1)mod size
>
> The Reader reads In and Out. If ==, go away, no data.
> Otherwise, reads Buffer[Out], writes Out=(Out+1)mod size.

That's actually pretty much what we're doing - it's been running in some
form or other for 20 years.  One writer and one reader.

I've put in a critical section now anyway, but it won't do any harm.
Technical Details
Message-ID: <40f39209$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40eea7bc@newsgroups.borland.com> <40eeb624$1@newsgroups.borland.com> <40f24e6d@newsgroups.borland.com> <40f2522a$1@newsgroups.borland.com> <40f252c7@newsgroups.borland.com> <36l4f09t2v3s9mb9gf7g36pu0k7aojgpke@4ax.com> <40f25cf8$1@newsgroups.borland.com> <lrn4f0hhholsg4362ujbhp26kc6q1bb45r@4ax.com> <gq66f0dk1vn948tu1o21sba1r8s6iht3fu@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,f4373c97b27dc766
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Chris Phillips" <chris.phillips@corusgroup.com>
From: "Chris Phillips" <chris.phillips@corusgroup.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <40eea7bc@newsgroups.borland.com> <40eeb624$1@newsgroups.borland.com> <40f24e6d@newsgroups.borland.com> <40f2522a$1@newsgroups.borland.com> <40f252c7@newsgroups.borland.com> <36l4f09t2v3s9mb9gf7g36pu0k7aojgpke@4ax.com> <40f25cf8$1@newsgroups.borland.com> <lrn4f0hhholsg4362ujbhp26kc6q1bb45r@4ax.com> <gq66f0dk1vn948tu1o21sba1r8s6iht3fu@4ax.com>
Subject: Re: Sleep() doesn't work as I'd expect
Date: Tue, 13 Jul 2004 08:40:59 +0100
Lines: 18
Organization: Corus
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4922.1500
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4939.300
NNTP-Posting-Host: 145.8.171.20
Message-ID: <40f39209$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1089704457 145.8.171.20 (13 Jul 2004 00:40:57 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail