Re: simple long long var operation atomic on 32 bit systems?



On Mar 8, 6:50 am, "David Schwartz" <dav...@xxxxxxxxxxxxx> wrote:
On Mar 7, 5:20 am, "mliptak" <Meht...@xxxxxxxxx> wrote:

The question really makes no sense. I know of no platform where it's
even legal. (POSIX, for example, prohibits one thread from accessing a
variable while another thread is or might be modifying it. So it's not
just not thread safe and not atomic, it's not allowed at all.)
I don't get this. What is not allowed? The C code the OP posted?

By the POSIX pthreads standard, it is not allowed if another thread
might be accessing the variable at the same time. If another thread
cannot access the variable at the same time, it is perfectly safe, but
then why would you care if it's atomic or not?

So the question must be referring to some threading standard other
than POSIX threads. In POSIX threads, the answer is simply that one
thread is not permitted to modify a variable while another thread
might be accessing it.

DS

Ok I thought you're saying the implementation of pthreads thread won't
access a variable while other thread is modifying it ;)
m

.



Relevant Pages

  • Re: Per-source CFLAGS
    ... >> This leaves little scope for modifying the default rules. ... > exception of the extra space in the argument list, ... > think that's what the POSIX people were thinking. ... I only care about the POSIX part of sys.mk for now. ...
    (freebsd-arch)
  • Re: simple long long var operation atomic on 32 bit systems?
    ... variable while another thread is or might be modifying it. ... just not thread safe and not atomic, ... By the POSIX pthreads standard, it is not allowed if another thread ...
    (comp.programming.threads)
  • Re: simple long long var operation atomic on 32 bit systems?
    ... are simple C code operations like these thread safe / atomic ... (POSIX, for example, prohibits one thread from accessing a ... variable while another thread is or might be modifying it. ...
    (comp.programming.threads)
  • Re: file offset corruption on 32-bit machines?
    ... to have found sentence in POSIX that says so. ... but it did say "thread safe" which I suppose ... More majordomo info at http://vger.kernel.org/majordomo-info.html ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)
  • printf vsnprintf snprintf
    ... Are these functions thread safe in RedHat ... Thread model: posix ... Thanks Much for your attention, is there a place to find answers to ...
    (comp.os.linux.misc)