-----Original Message-----
From: Thomas Weidenmueller [mailto:w3seek@reactos.com]
Sent: 17 November 2005 23:38
To: ReactOS Development List
Subject: Re: [ros-dev] Re: [ros-diffs] [gedmurphy] 19312:
Improve stopping control of the service
Ged Murphy wrote:
Could you explain what you mean?
As you
want to change the value of the variables which are used in a
multithreaded environment you need to used the Interlocked*
functions to
ensure an atomic change in all environments (UP, MP, ...), and also to
make sure it's portable.
Those variables are only modified within the base
thread, all other
threads just check the value and act upon it.
Why would that not be thread safe?
You're assuming the code will only run on a
x86 system. In
fact, as long
as the variables are aligned properly it is an atomic operation. But
don't forget the other architectures and possibly upcoming
technologies
based on x86 that could void this assumption.
I have to admit that the code wouldn't break, even in circumstances
where the operation wouldn't be atomic, but technically the code still
isn't thread-safe this way.
- Thomas
This function is new to me.
I'm just doing a bit of research on it now to better understand it, but
could you just give me a bit of background of the difference between this,
and using something like a mutex or CS, and why it's better in this
scenario?
Thanks,
Ged.
************************************************************************
The information contained in this message or any of its
attachments is confidential and is intended for the exclusive
use of the addressee. The information may also be legally
privileged. The views expressed may not be company policy,
but the personal views of the originator. If you are not the
addressee, any disclosure, reproduction, distribution or other
dissemination or use of this communication is strictly prohibited.
If you have received this message in error, please contact
postmaster(a)exideuk.co.uk
<mailto:postmaster@exideuk.co.uk> and then delete this message.
Exide Technologies is an industrial and transportation battery
producer and recycler with operations in 89 countries.
Further information can be found at
www.exide.com