Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

From: Gleb Natapov (glebn_at_[hidden])
Date: 2007-03-06 04:37:04


On Tue, Mar 06, 2007 at 10:10:44AM +0100, Bert Wesarg wrote:
> Fix the double-check locking[1] by defining the cls_initialized member to
> volatile.
>
> Greetings
>
> Bert Wesarg
>
> [1]: http://en.wikipedia.org/wiki/Double-checked_locking
Can you explain how the Java example from this page applies to the code
in Open MPI? cls_initialized is set only after class is fully
initialized and usable.

>
>

> ---
>
> opal/class/opal_object.h | 2 +-
> 1 files changed, 1 insertion(+), 1 deletion(-)
>
> diff --quilt old/opal/class/opal_object.h new/opal/class/opal_object.h
> --- old/opal/class/opal_object.h
> +++ new/opal/class/opal_object.h
> @@ -148,11 +148,11 @@ typedef void (*opal_destruct_t) (opal_ob
> struct opal_class_t {
> const char *cls_name; /**< symbolic name for class */
> opal_class_t *cls_parent; /**< parent class descriptor */
> opal_construct_t cls_construct; /**< class constructor */
> opal_destruct_t cls_destruct; /**< class destructor */
> - int cls_initialized; /**< is class initialized */
> + volatile int cls_initialized; /**< is class initialized */
> int cls_depth; /**< depth of class hierarchy tree */
> opal_construct_t *cls_construct_array;
> /**< array of parent class constructors */
> opal_destruct_t *cls_destruct_array;
> /**< array of parent class destructors */

> _______________________________________________
> devel mailing list
> devel_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/devel

--
			Gleb.