On Thu, 05 Feb 2009, Mindaugas Kavaliauskas wrote: Hi,
> one more thread question: > STATIC mtx := hb_mutexCreate() > Thread1: > LOCAL xI > xI := some_value > hb_mutexNotify(mtx, xI) > xI := NIL // or xI := another_value > Thread2: > LOCAL xI, xParam > hb_mutexSubscribe(mtx,, @xParam) > xI := xParam > Is this code thread safe? The problem is that, if some_value is complex > type "xI := NIL" in thread1 decreases reference counter, and "xI := xParam" > in thread2 increases reference counter of the same some_value. These > operations are not protected by any mutex. It is thread safe. All reference counters in Harbour core code are updated by atomic inc/dec operations (see hbatomic.h) so they are protected and MT safe. best regards, Przemek _______________________________________________ Harbour mailing list Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour