Click here to Skip to main content
16,005,037 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Semaphore issue Pin
N a v a n e e t h12-Aug-09 7:23
N a v a n e e t h12-Aug-09 7:23 
AnswerRe: Semaphore issue Pin
Mark Salsbery12-Aug-09 7:26
Mark Salsbery12-Aug-09 7:26 
QuestionPorting Remoting to WCF architecture problem Pin
cignox111-Aug-09 20:45
cignox111-Aug-09 20:45 
QuestionSynchronisation question Pin
Esmo200011-Aug-09 14:25
Esmo200011-Aug-09 14:25 
AnswerRe: Synchronisation question Pin
Not Active11-Aug-09 15:13
mentorNot Active11-Aug-09 15:13 
GeneralRe: Synchronisation question Pin
Esmo200011-Aug-09 15:24
Esmo200011-Aug-09 15:24 
AnswerRe: Synchronisation question Pin
N a v a n e e t h11-Aug-09 15:29
N a v a n e e t h11-Aug-09 15:29 
AnswerRe: Synchronisation question Pin
harold aptroot11-Aug-09 15:32
harold aptroot11-Aug-09 15:32 
No offense but most of what you said is untrue on some level..
You don't need mutual exclusion for a bool
x86's don't care about "volatile" and have no notion of it (MTRRs control caching, but the cache is coherent anyway), the "volatile" keyword makes sure that the value is actually fetched (that can be from the cache, but it doesn't matter, since it's coherent anyway) instead of reused if it is already in a register (and the same for writing) and guarantees that those operations won't be reordered by the compiler (the CPU can still reorder it, but only under some circumstances)

It's all very complicated. Unless you want to do assembly programming it usually isn't even relevant, especially if you'd just use the existing synchronization primitives.. see below.

Just making the bool volatile should usually be enough, since it's just a bool, and you may not even need that (usually works anyway, but better be safe than sorry)

However, I don't have a lot of information here go to on, but usually you should use normal synchronization primitives when dealing with synchronization, instead of making one up out of a bool. Like ManualResetEvent, or one of the static functions in Interlocked (if you need something low-level). At least, that's what I got told Smile | :)


ps: I'm sorry for any inaccuracies in this post, it is a complex subject, and I'm not even an expert on this Smile | :)



AnswerRe: Synchronisation question Pin
Luc Pattyn11-Aug-09 15:35
sitebuilderLuc Pattyn11-Aug-09 15:35 
GeneralRe: Synchronisation question Pin
harold aptroot11-Aug-09 16:00
harold aptroot11-Aug-09 16:00 
GeneralRe: Synchronisation question Pin
Luc Pattyn11-Aug-09 16:14
sitebuilderLuc Pattyn11-Aug-09 16:14 
GeneralRe: Synchronisation question Pin
supercat912-Aug-09 6:19
supercat912-Aug-09 6:19 
QuestionHigh number of Handles Pin
Leonardo Muzzi11-Aug-09 4:51
Leonardo Muzzi11-Aug-09 4:51 
AnswerRe: High number of Handles Pin
Dave Kreskowiak11-Aug-09 5:16
mveDave Kreskowiak11-Aug-09 5:16 
AnswerRe: High number of Handles Pin
Luc Pattyn11-Aug-09 5:16
sitebuilderLuc Pattyn11-Aug-09 5:16 
AnswerRe: High number of Handles Pin
N a v a n e e t h11-Aug-09 5:27
N a v a n e e t h11-Aug-09 5:27 
GeneralRe: High number of Handles Pin
Leonardo Muzzi11-Aug-09 7:09
Leonardo Muzzi11-Aug-09 7:09 
GeneralRe: High number of Handles Pin
N a v a n e e t h11-Aug-09 15:22
N a v a n e e t h11-Aug-09 15:22 
GeneralRe: High number of Handles Pin
Leonardo Muzzi12-Aug-09 8:02
Leonardo Muzzi12-Aug-09 8:02 
AnswerRe: High number of Handles Pin
Moreno Airoldi11-Aug-09 6:44
Moreno Airoldi11-Aug-09 6:44 
Questionvb.net-code error Pin
myinstincts10-Aug-09 22:28
myinstincts10-Aug-09 22:28 
AnswerRe: vb.net-code error Pin
Pete O'Hanlon10-Aug-09 23:21
mvePete O'Hanlon10-Aug-09 23:21 
Questionvb.net-code error again Pin
myinstincts10-Aug-09 22:15
myinstincts10-Aug-09 22:15 
AnswerRe: vb.net-code error again Pin
0x3c010-Aug-09 22:18
0x3c010-Aug-09 22:18 
AnswerRe: vb.net-code error again Pin
Hristo-Bojilov10-Aug-09 22:21
Hristo-Bojilov10-Aug-09 22:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.