Adrian, opal_obj_update does not fail or success, it returns the new obj_reference_count.
can you point to one specific location in the code where you think it is wrong ? OBJ_RELEASE(buffer) buffer = NULL; could be written as if (((opal_object_t *)buffer)->obj_reference_count == 1) { OBJ_RELEASE(buffer); } else { buffer = NULL; } that would never ever set buffer to NULL twice, but would be wrong since there is no atomicity here /* that was for for the "unnecessary" part */ about the "wrong" part, why do you think the else branch is wrong ? /* i mean setting a pointer to NULL is not necessarily wrong */ Cheers, Gilles On 2015/02/12 16:41, Adrian Reber wrote: > At many places all over the code I see > > OBJ_RELEASE(buffer) > buffer = NULL; > > Looking at the definition of OBJ_RELEASE() this seems unnecessary and > wrong: > > #define OBJ_RELEASE(object) \ > do { \ > if (0 == opal_obj_update((opal_object_t *) (object), -1)) { \ > opal_obj_run_destructors((opal_object_t *) (object)); \ > free(object); \ > object = NULL; \ > } \ > } while (0) > > The object is set to NULL by the macro and only if the opal_obj_update() was > successful. So it seems setting the buffer manually to NULL after > OBJ_RELEASE() > is unnecessary and if opal_obj_update() failed it also is wrong. > > Adrian > _______________________________________________ > devel mailing list > de...@open-mpi.org > Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/devel > Link to this post: > http://www.open-mpi.org/community/lists/devel/2015/02/16970.php