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
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to