🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Thread questions

#13639
From: Remy Lebeau (TeamB)
Date: Wed, 01 Oct 2003 18:20
35 lines
2328 bytes
"Jonathan Starr" <starr@belsoft.com> wrote in message
news:3f7b0c4e$1@newsgroups.borland.com...

> PS What is happening is that the low-pri thread *appears* to
> begin executing at a random point while the high-pri thread
> is busy again.

That should not be an issue, though.  Threads do not have any concept of
their timings.  A thread shouldn't care about such things.  If the real
issue is that you have a low-pri thread that is not resuming when you need
it to, then you should consider tweaking the thread priorities differently.
Alternatively, when the hi-pri thread resumes the lo-pri thread, the hi-pri
thread could then call Sleep() to allow the lo-pri thread the oppurtunity to
actually start right away (assuming you don't have other threads running).


> A thread may acquire a TCriticalSection a lock multiple times
> before releasing it.  The lock maintains a counter internally.

Correct.

> I had thought that if a thread acquired such a lock several times
> and released it once, it still held it - another thread would block
> trying to acquire it until it was released as many times as acquired.

Correct.

> But I am seeing a case in which a single release seems to
> allow another thread to acquire the lock.

Please show your actual code.


Gambit
Technical Details
Message-ID: <3f7b1a8d$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!38.144.126.70.MISMATCH!feed3.newsreader.com!newsreader.com!newsfeed.news2me.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f7b0c4e$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,daa80f767a159c0c
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-10-01 11:39:47 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f7b0c4e$1@newsgroups.borland.com>
Subject: Re: Thread questions
Date: Wed, 1 Oct 2003 11:20:22 -0700
Lines: 37
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 67.23.78.204
Message-ID: <3f7b1a8d$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1065032333 67.23.78.204 (1 Oct 2003 11:18:53 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!38.144.126.70.MISMATCH!feed3.newsreader.com!newsreader.com!newsfeed.news2me.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail