Re: Re[2]: terminating a system thread

Good point. Besides on intel architecture read/write on single bytes
are garantied atomic and bools are usually just single bytes. Unless
you’ll be passing a long a pointer or smething as well, there is no
need for synchronization.

Anders

Friday, May 18, 2001, 11:49:49 AM, you wrote:

RM> Fine (sort of) then your reader thread has a loop, and as part of that loop
RM> you read your boolean. Either you read it before or after your writer thread
RM> writes it. Interlocking is not going to help here as it remains a fact that
RM> either you read the value before it is written, or you read it after. If
RM> your reader reads before it is written, well then next time around it will
RM> read it after it is written. You do some dma work, read your flag, repeat
RM> until asked to die.

RM> Having a thread that is continuously busy, even when it perhaps has nothing
RM> to do, is not such a good idea.

RM> -----Original Message-----
RM> From: rajinder sharma [mailto:xxxxx@hotmail.com]
RM> Sent: Friday, May 18, 2001 2:34 PM
RM> To: NT Developers Interest List
RM> Subject: [ntdev] Re: Re[2]: terminating a system thread

RM> But my reader can not wait for any event. It is continuously processing data

RM> and can not wait for any event. Its like continuously doing DMA and then
RM> should be able to get terminated by some asynchronous event in some other
RM> part of the driver.
RM> thanks

>If your writer writes the location and then sets the event, your reader
>will
>either wake up and then do the read AFTER the write occurs, or will have
>already woken up for some other reason, do the read BEFORE the write
>occurs,
>but then when your reader does a wait on your event, it will still be set,
>and consequently your reader will wake up and do the read AFTER the write.
>You do not need an interlocked operation here, nor would it help.
RM> _________________________________________________________________________
RM> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

RM> —
RM> You are currently subscribed to ntdev as: xxxxx@stratus.com To
RM> unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

RM> —
RM> You are currently subscribed to ntdev as: xxxxx@flaffer.com
RM> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


Best regards,
Anders mailto:xxxxx@flaffer.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com