Click here to Skip to main content
16,012,116 members
Home / Discussions / C#
   

C#

 
GeneralRe: thread safety using Interlocked Pin
George_George17-May-08 21:23
George_George17-May-08 21:23 
GeneralRe: thread safety using Interlocked Pin
Guffa18-May-08 12:49
Guffa18-May-08 12:49 
GeneralRe: thread safety using Interlocked Pin
George_George19-May-08 2:29
George_George19-May-08 2:29 
AnswerRe: thread safety using Interlocked Pin
N a v a n e e t h16-May-08 2:41
N a v a n e e t h16-May-08 2:41 
GeneralRe: thread safety using Interlocked Pin
George_George16-May-08 3:04
George_George16-May-08 3:04 
GeneralRe: thread safety using Interlocked Pin
N a v a n e e t h16-May-08 4:25
N a v a n e e t h16-May-08 4:25 
GeneralRe: thread safety using Interlocked Pin
George_George16-May-08 4:44
George_George16-May-08 4:44 
GeneralRe: thread safety using Interlocked Pin
Guffa16-May-08 6:22
Guffa16-May-08 6:22 
George_George wrote:
Only add volatile to read, no need to add to write?


You add volatile to the declaration of the variable. This will keep the compiler from optimising away reads and writes.

However, the only situation where a write would ever be possible to optimise away, would be if you assign it more than once in a code block without any alternative execution paths. Like this:
Status = 1;
Status = 0;


Despite everything, the person most likely to be fooling you next is yourself.

GeneralRe: thread safety using Interlocked Pin
George_George16-May-08 20:14
George_George16-May-08 20:14 
GeneralRe: thread safety using Interlocked Pin
Guffa17-May-08 9:22
Guffa17-May-08 9:22 
GeneralRe: thread safety using Interlocked Pin
George_George17-May-08 21:21
George_George17-May-08 21:21 
GeneralRe: thread safety using Interlocked Pin
Guffa18-May-08 12:54
Guffa18-May-08 12:54 
GeneralRe: thread safety using Interlocked Pin
George_George19-May-08 2:30
George_George19-May-08 2:30 
Questionhow access to a fild in a record in data grid ? [modified] Pin
bizhanmp15-May-08 22:42
bizhanmp15-May-08 22:42 
AnswerRe: how access to a fild in a record in data grid ? Pin
Sacha Barber16-May-08 1:02
Sacha Barber16-May-08 1:02 
GeneralPowerShell Query Pin
Kevin McFarlane15-May-08 22:24
Kevin McFarlane15-May-08 22:24 
GeneralRe: PowerShell Query Pin
ChrisKo16-May-08 7:36
ChrisKo16-May-08 7:36 
GeneralRe: PowerShell Query Pin
Kevin McFarlane16-May-08 8:13
Kevin McFarlane16-May-08 8:13 
QuestionControl for handling a lot of Images Pin
anderslundsgard15-May-08 22:09
anderslundsgard15-May-08 22:09 
AnswerRe: Control for handling a lot of Images Pin
Christian Graus15-May-08 22:58
protectorChristian Graus15-May-08 22:58 
GeneralRe: Control for handling a lot of Images Pin
anderslundsgard15-May-08 23:44
anderslundsgard15-May-08 23:44 
QuestionFileStream object and performance concern Pin
rcollina15-May-08 21:30
rcollina15-May-08 21:30 
AnswerRe: FileStream object and performance concern Pin
ChrisKo16-May-08 7:35
ChrisKo16-May-08 7:35 
AnswerRe: FileStream object and performance concern Pin
The Nightcoder16-May-08 11:49
The Nightcoder16-May-08 11:49 
AnswerRe: FileStream object and performance concern Pin
rcollina16-May-08 21:37
rcollina16-May-08 21:37 

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.