Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== pthreads Maintain and talk to a pthread pool. == Overview 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. == Issues * Requires recent chicken version 4.11 or at least git master rev. 8294683 of 2016-01-14 * Starts currently 5 pthreads. TBD: make this configurable and start as many threads a the operating system configured processors are available. * The Scheme API is not yet tested. == Requirements None. == API === C <macro>typedef int (*C_pthread_request_function_t)(void *);</macro> <procedure>extern int start_asynchronous_request(C_pthread_request_function_t function, void *data, void *callback);</procedure> 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}}. <procedure>void C_interrupt_call(void *callback, void *result, void *value)</procedure> 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. === Scheme <procedure>(pool-send! JOB DATA CALLBACK) -> undefined</procedure> 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}}. == Examples * [[https://github.com/0-8-15/sqlite3pth|sqlite3pth egg repository]] on github. (define sqlite3-start-prepare (foreign-lambda* void ((<sqlite3-prepare-args> s) (nonnull-c-pointer callback)) "start_asynchronous_request( pthread_sqlite3_prepare, s, callback);")) * Ask the author for alpha code running fuse on pthreads. == About this egg === Author Jörg F. Wittenberger === Source Code The [[https://github.com/0-8-15/pthreads|pthreads egg repository]] is maintained on github. === Version History 0.2: Ported to CHICKEN 5. 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 [[http://ball.askemos.org|Askemos/BALL]]. Years later, in 2010, it was converted into an module of it's own. === License BSD
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you add 2 to 22?