Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming.threads > #424
| From | Alexander Terekhov <terekhov@web.de> |
|---|---|
| Newsgroups | comp.programming.threads |
| Subject | Re: Interlocked operations, volatile |
| Date | 2011-07-13 20:03 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <4E1DDDD5.AA6B4306@web.de> (permalink) |
| References | <99a57186-cf9f-47ee-8955-07df1ce2b126@b21g2000yqc.googlegroups.com> |
Andrew Che wrote:
>
> Greetings!
>
> Q1: Is it true that the only goal of using interlocked operations is
> to guarantee that read/write operations are completed in proper order?
Not true.
> Q2: Is it true that the goal of 'volatile' is the same?
Not true.
> Q3: Is it nessesary to use 'int* volatile ptr' or some interlocked
> operation in line [???] to be sure function2 is correct (see sample
> below)?
Not necessary.
>
> == START SAMPLE ==
>
> int value = 42;
> int* ptr = 0;
>
> void function1 () { // called from many threads
> cas(&ptr, &value, 0); // some compare-and-swap function
> }
>
> void function2 () { // called from many threads
> if(!ptr) { // [???]
> return;
> some_func(ptr);
> }
> == END SAMPLE ==
>
> Cheers,
> Andrew
regards,
alexander.
Back to comp.programming.threads | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Interlocked operations, volatile Andrew Che <libera.ventis@gmail.com> - 2011-07-13 09:43 -0700
Re: Interlocked operations, volatile Alexander Terekhov <terekhov@web.de> - 2011-07-13 20:03 +0200
Re: Interlocked operations, volatile David Schwartz <davids@webmaster.com> - 2011-07-13 15:24 -0700
Re: Interlocked operations, volatile Andrew Che <libera.ventis@gmail.com> - 2011-07-14 00:13 -0700
Re: Interlocked operations, volatile Andrew Che <libera.ventis@gmail.com> - 2011-07-14 00:17 -0700
Re: Interlocked operations, volatile Andrew Che <libera.ventis@gmail.com> - 2011-07-14 00:37 -0700
Re: Interlocked operations, volatile Andrew Che <libera.ventis@gmail.com> - 2011-07-14 00:41 -0700
Re: Interlocked operations, volatile Andrew Che <libera.ventis@gmail.com> - 2011-07-14 00:44 -0700
Re: Interlocked operations, volatile Andrew Che <libera.ventis@gmail.com> - 2011-07-14 00:31 -0700
Re: Interlocked operations, volatile Andrew Che <libera.ventis@gmail.com> - 2011-07-14 00:52 -0700
Re: Interlocked operations, volatile David Schwartz <davids@webmaster.com> - 2011-07-14 03:06 -0700
Re: Interlocked operations, volatile David Schwartz <davids@webmaster.com> - 2011-07-14 06:16 -0700
Re: Interlocked operations, volatile Alexander Terekhov <terekhov@web.de> - 2011-07-14 17:20 +0200
Re: Interlocked operations, volatile David Schwartz <davids@webmaster.com> - 2011-07-14 09:19 -0700
Re: Interlocked operations, volatile Andrew Che <libera.ventis@gmail.com> - 2011-07-14 08:52 -0700
Re: Interlocked operations, volatile David Schwartz <davids@webmaster.com> - 2011-07-14 10:51 -0700
Re: Interlocked operations, volatile Alexander Terekhov <terekhov@web.de> - 2011-07-14 23:05 +0200
Re: Interlocked operations, volatile Andrew Che <libera.ventis@gmail.com> - 2011-07-14 08:49 -0700
Re: Interlocked operations, volatile Andrew Che <libera.ventis@gmail.com> - 2011-07-14 00:48 -0700
Re: Interlocked operations, volatile frege <gottlobfrege@gmail.com> - 2011-07-20 22:13 -0700
csiph-web