Article View: borland.public.cppbuilder.nativeapi
Article #13641Re: Thread questions
From: Jonathan Starr
Date: Wed, 01 Oct 2003 19:37
Date: Wed, 01 Oct 2003 19:37
69 lines
3122 bytes
3122 bytes
Remy Lebeau (TeamB) wrote: >"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. > In this case it does matter, since the threads are intimately connected by shared data. > 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. > Can't. The hi-pri is the UI, and if I make the other one higher, the UI events get lost. Is there any way to avoid this? >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). > I tried Sleep ( ) and it seems to have fixed things, thanks very much!!! I don't have the Windows API docs - can you tell me what its argument means (I just used 1)? >>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. > > Impractical. I could spend days trying to strip it down to a reasonable case. I may check over my data and see if I am not seeing what I thought I was. Thanks for the help.
Technical Details
Message-ID:
<3f7b2ae6@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news-out.visi.com!petbe.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f7b0c4e$1@newsgroups.borland.com> <3f7b1a8d$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 12:40:12 PST Date: Wed, 01 Oct 2003 15:37:01 -0400 From: Jonathan Starr <starr@belsoft.com> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Thread questions References: <3f7b0c4e$1@newsgroups.borland.com> <3f7b1a8d$1@newsgroups.borland.com> In-Reply-To: <3f7b1a8d$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 66.217.148.63 Message-ID: <3f7b2ae6@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1065036518 66.217.148.63 (1 Oct 2003 12:28:38 -0700) Lines: 70 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news-out.visi.com!petbe.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail