[EMAIL PROTECTED] wrote:
I notice the sys/atomic.h atomic_xxx interfaces are limited to things 
that do read/modify/write (inc/dec/swap/etc). There is no atomic_set to 
do a simple assignment.
    

My question is: what protocol is  used to update a specific variable to
a specific value WHILE AT THE SAME TIME another part can also
update the variable to a different specific value.
  
The specific situation that raised the question is a signal handler.  The same signal handler function was used for several signals that are all taken to mean "clean up and shut down".  The function saved the signal to an unprotected global variable.  If different signals are received, we don't care which one the global ends up being set to.

The signal handler could be written differently to eliminate the atomicity question.  But other scenarios come to mind also.  Such as setting an error in a shared piece of memory (where it might be sufficient to attempt to keep the first error, but in race conditions perhaps get the second error).
(After the update, the variable can have any of N values
Right - this only applies to situations where any of the N values are acceptable.

-Joe


_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to