Does that mean that on intel arch, single bytes are always protected against
simultaneous operations? How about this structure :
typedef struct
{
boolean a;
boolean b;
int c,
boolean d;
char e
}myStruct;
will myStruct.a, myStruct.b, myStruct.d and myStrcut.e will always be
protected for synchronisation or its only dependant on the total size of the
strcuture?
In fact I have such a big struct and my boolean var is a part of that
structure and this struct is always passed as pointer.
thanks
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.
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.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