[fpc-devel] Threads and alot of crap
Marc Weustink
marc.weustink at cuperus.nl
Tue Oct 17 10:49:33 CEST 2006
Daniël Mantione wrote:
>
> Op Tue, 17 Oct 2006, schreef Jonas Maebe:
>
>> On 17 okt 2006, at 09:25, Daniël Mantione wrote:
>>
>>> If I compare my implementation of the Chameneos benchmark with the one
>>> from Marc (which uses Pthreads directly), mine is about two times slower.
>>> This is propably caused that our thread functions often require multiple
>>> Pthread calls,
>> Where? I only see this in starting/initialising/stopping/destructing things.
>> The actual locking etc use one pthread call in all cases afaics. Of course,
>> starting a Pascal thread requires initialising all the threadvars etc, but
>> that is not going to change if you use something else than pthreads.
>
> For example:
>
> procedure intRTLEventSetEvent(AEvent: PRTLEvent);
> var p:pintrtlevent;
>
> begin
> p:=pintrtlevent(aevent);
> pthread_mutex_lock(@p^.mutex);
> pthread_cond_signal(@p^.condvar);
> pthread_mutex_unlock(@p^.mutex);
> end;
This was exactly the reason why I choose to use pthreads directly. For
the given situation one single semaphore call could replace this.
Marc
More information about the fpc-devel
mailing list