chickadee » pthreads

Outdated egg!

This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.


Maintain and talk to a pthread pool.


Most of the egg's work is done in the startup: a pool of pthreads waiting for a job is initialized.

Only code having a C calling convention can be sent to the pool (and asynchronously call back to Scheme). Scheme code runs in the CHICKEN thread.






typedef int (*C_pthread_request_function_t)(void *);syntax

Send function to be executed at any thread of the pool. Function must accept one argument, the data. Callback must be a C_GC_ROOT object holding the procedure to receive the result for function.


Tell CHICKEN to call the procedure held in the C_GC_ROOT object callback on the result of applying the C_GC_ROOT object result to value.

Predecessor of concurrent-native-callbacks - it may be easier to use the latter.


pool-send! JOB DATA CALLBACKprocedure

All arguments given as non-null-c-pointer.

JOB: The C procedure to call

DATA: Opaque pointer for parameter passing.

CALLBACK: Pointer to callback procedure wrapped in a C_GC_ROOT. The callback is called with the value returned by JOB.


       (define sqlite3-start-prepare
          ((<sqlite3-prepare-args> s) (nonnull-c-pointer callback))
            pthread_sqlite3_prepare, s, callback);"))

About this egg


Jörg F. Wittenberger

Source Code

The pthreads egg repository is maintained on github.

Version History

Version 0.1: Initial import.

Before: This code was ported from an RScheme module of the same author several years ago. Since it's been used in Askemos/BALL. Years later, in 2010, it was converted into an module of it's own.



Contents »