Walter,

I've found that with gcc I have a builtin.h header with several atomic 
functions.

There are functions for signed and unsigned 32bits increment/decrement, which
one should I use? I see that in windows you cast to a (long *), but hvm.c
passes to HB_ATOMIC_INC() a ulHolders, for example, line 9355. So, which is
the correct operation to do?

Last one, I still need to use mutexes at the .prg level, am I right?

Maurilio.

PS. I can add builtin.h if you need to look at it.

Walter Negro wrote:
> Maurilio,
> 
> if you test mtcomplexshare.prg without the change in my commit, you can
> obtain GPFs or Internal Error (Premature Pointer Release detected).
> 
> The problem in low level is similar to problem in high level that you
> see executing mtcomplexshare.prg without mutex.
> 
> Some platforms or compilers do not have functions for atomic increment
> and decrement, but some compilers create atomic increment and decrement
> when using vars volatile.
> 
> 
> 
> *Walter Negro*
> /Desarrollo e Investigación/
> VsTour - Softmagic S.R.L.
> <mailto:[EMAIL PROTECTED]>
> ------------------------------------------------------------------------
> *::* * VSTour.COM <http://www.vstour.com> * *::*
> 
> 
> Maurilio Longo escribió:
>> Walter,
>>
>> I'm not sure I'm understanding this, but I did a test with
>> mtcomplexshare.prg
>> and I see that nGlobalCounter is protected by a mutex lock/unlock
>> sequence.
>>
>> If I remove those mutex calls on OS/2 with GCC at the end the result
>> shows big
>> differences.
>>
>> --------8<----------------
>> Thread 1 - LocalCounter=   5449444
>> Thread 2 - LocalCounter=   5469999
>> Total                     10919443
>>
>>           GlobalCounter=   6345520
>>
>> Difference                 4573923
>> (E:\repos2\xharbour\tests)
>> -------->8----------------
>>
>> See attachment.
>>
>> Maurilio.
>>
>>
>>
>> Walter Negro wrote:
>>  
>>> 2008-06-28 15:25 UTC-0300 Walter Negro <anegro/at/overnet.com.ar>
>>>  * include\hbdefs.h
>>>  * include\hbvmpub.h
>>>  * include\thread.h
>>>  * source\rtl\hbxml.c
>>>  * source\vm\arrays.c
>>>  * source\vm\arrayshb.c
>>>  * source\vm\codebloc.c
>>>  * source\vm\fastitem.c
>>>  * source\vm\fm.c
>>>  * source\vm\garbage.c
>>>  * source\vm\hvm.c
>>>  * source\vm\itemapi.c
>>>  * source\vm\thread.c
>>>  * tests\mtcomplexshare.prg
>>>    * Added atomic or volatile increment and decrement of counters of
>>> complex types and structures.
>>>      Now is safe to share complex data type in diferent threads if C
>>> compiler or OS support
>>>      function or create ASM thread-safe to inc/dec.
>>>      NOTE: Atomic increment and decrement need counter memory aligned
>>> and 32 bits of lenght.
>>>
>>> Walter Negro
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>>
>>> No virus found in this outgoing message.
>>> Checked by AVG. Version: 8.0.101 / Virus Database: 270.4.2/1523 -
>>> Release Date: 28/06/2008 07:00 a.m.
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> -------------------------------------------------------------------------
>>>
>>> Check out the new SourceForge.net Marketplace.
>>> It's the best place to buy or sell services for
>>> just about anything Open Source.
>>> http://sourceforge.net/services/buy/index.php
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> xHarbour-developers mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/xharbour-developers
>>>     
>>
>>   
> 
> 
> 

-- 
 __________
|  |  | |__| Maurilio Longo
|_|_|_|____| farmaconsult s.r.l.



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
xHarbour-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xharbour-developers

Reply via email to