Re: Boolean access in multithreaded environment
From: Chris Tacke, eMVP (ctacke[at]Open_NET_CF[dot]org)
Date: 05/21/04
- Next message: Barry Bond: "Re: ExpandEnvironmentStrings"
- Previous message: Peter Foot [MVP]: "Re: Contacts, Appointments and Tasks Databases"
- In reply to: ManojM: "Boolean access in multithreaded environment"
- Next in thread: Jon Skeet [C# MVP]: "Re: Boolean access in multithreaded environment"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 21 May 2004 07:56:35 -0400
The CF doesn't support volatile, but I'd use a sych feature like a lock or
mutex to make sure that writes and reads don't step on one another, atomic
or not. That simply good coding practice.
-Chris
<ManojM> wrote in message news:OEczsOyPEHA.1644@TK2MSFTNGP09.phx.gbl...
> Hi
> I have one thread assigning true/false to boolean and another thread
> accessing the value of the boolean. I need this operation to be thread
safe.
> Someone told me that boolean assignment is atomic operation and thats why
I
> need not make it volatile. Is it true that its atomic or should I make it
> volatile/restrict its access by lock?
>
> Thanks
> Manoj
>
>
- Next message: Barry Bond: "Re: ExpandEnvironmentStrings"
- Previous message: Peter Foot [MVP]: "Re: Contacts, Appointments and Tasks Databases"
- In reply to: ManojM: "Boolean access in multithreaded environment"
- Next in thread: Jon Skeet [C# MVP]: "Re: Boolean access in multithreaded environment"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|