Re: Strange Behavior

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Well, as presented it seems to just about work for me - i.e. the value
increments, but I suspect you are hitting one of the following:

1: value-type handling: if the struct is accessed e.g. through a
property, then the value will be cloned, with you updating the separate
copy
2: volatility: another thread looking at this field directly in a tight
look may not notice the change i.e. the value might be in a register

My first question would be: why is this a struct? It feels like it
should be a class, since you seem to want to share it between callers
(which structs are not geared up to do).

Also - (advisory only) - a: accessing fields directly (rather than
through properties) isn't all that recommended; b: since it is static
you may need to make this thread safe (synchronised access) if you are
ever going to do anything complex with threading, otherwise various
gotchas apply. Sounds like this may not be an issue.

But try making it a class; I suspect this will fix everything.

Marc

.



Relevant Pages

  • Re: Review of San Jose Show
    ... fresh for a greatest-hits set. ... I suspect this had a lot to do with Lindsey Buckingham, ... believe is still hitting his stride with recent 2 fantastic albums and ...
    (rec.music.artists.springsteen)
  • Re: Remaining u32 vs. pm_message_t fixes
    ... I suspect there's more than that still remaining. ... $ grep suspend include/asm-arm -r ... changing pm_message_t to a struct. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: Review of San Jose Show
    ... fresh for a greatest-hits set. ... I suspect this had a lot to do with Lindsey Buckingham, ... believe is still hitting his stride with recent 2 fantastic albums and ...
    (rec.music.artists.springsteen)
  • Re: OT Damn, Manny gone for 50 games
    ... with tight swings, and are still hitting them 500 feet, that I ... suspect. ... Howard's physique actually reminds me of Babe Ruth's: ...
    (alt.sports.basketball.nba.la-lakers)
  • Re: Pagination/text move to next page
    ... of hitting enter until a line indicating a page break appeared). ... >> Hi Greg, ... >> suspect that hitting enter all over the place whenever you need space, ... >> The first way to check for a corrupt document is to ...
    (microsoft.public.mac.office.word)