lkml.org 
[lkml]   [2010]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Subjectmemory barrier question
From
Date
Hi,

I'm trying to understand memory barriers but not quite succeeding.

Consider the following example:

Start:
p = NULL;
x = 0;

CPU1:
atomic_inc(&x);
p = &x;

CPU2:
if (p)
z = atomic_read(p);

Is it possible to end up with z == 0? What if there's a lock/unlock
before setting "p"? What if there's a write barrier before setting
"p"?

Thanks,
Miklos


\
 
 \ /
  Last update: 2010-09-15 16:39    [W:0.148 / U:0.660 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site