[fpc-pascal] pthread_cond_t and pthread_mutex_t

Adriaan van Os fpc at microbizz.nl
Sun Aug 4 17:16:37 CEST 2019


The FPC runtime library seems to export the type definitions of pthread_mutex_t and pthread_cond_t 
but the functions that operate on them are private in cthreads.pp and pthread.inc.

So, is there a Pascal runtime library equivalent of the following code or should I redeclare the 
required C-functions ?

var
mutex: pthread_mutex_t;
condition: pthread_cond_t;

thread 1
------
pthread_mutex_lock( mutex);
while not condition do
     pthread_cond_wait( condition, mutex);
pthread_mutex_unlock( mutex);

thread 2:
------
pthread_mutex_lock( mutex);
pthread_cond_signal( condition);
pthread_mutex_unlock( mutex);

Regards,

Adriaan van Os


More information about the fpc-pascal mailing list