summaryrefslogtreecommitdiff
path: root/libguile/async.h
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2016-12-29 18:46:16 +0100
committerAndy Wingo <wingo@pobox.com>2016-12-29 18:46:16 +0100
commita0656ad4cf976b3845e9b9663a90b46b4cf9fc5a (patch)
tree22e621b5b32acb84fcbd82b1b7ff7d7f9e303740 /libguile/async.h
parent0ce8a9a5e01d3a12d83fea85968e1abb602c9298 (diff)
downloadguile-a0656ad4cf976b3845e9b9663a90b46b4cf9fc5a.tar.gz
New interfaces to help wait on fd/cond
* libguile/async.h: * libguile/async.c (struct scm_thread_wake_data): Include the cond to signal. Be a union and include a tag. (scm_i_prepare_to_wait): Rename from scm_i_setup_sleep and take wake data directly. Also call scm_i_wait_finished as appropriate. (scm_i_wait_finished): Rename from scm_i_reset_sleep. (scm_i_prepare_to_wait_on_fd, scm_c_prepare_to_wait_on_fd): (scm_i_prepare_to_wait_on_cond, scm_c_prepare_to_wait_on_cond): New functions. (scm_c_wait_finished): New function. (scm_system_async_mark_for_thread): Adapt to wake data change. * libguile/threads.c (block_self, scm_std_select): Adapt to async interface changes. * doc/ref/api-scheduling.texi (Asyncs): Doc new public interfaces.
Diffstat (limited to 'libguile/async.h')
-rw-r--r--libguile/async.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/libguile/async.h b/libguile/async.h
index c6d7202aa..2bca16df9 100644
--- a/libguile/async.h
+++ b/libguile/async.h
@@ -33,10 +33,12 @@ SCM_API void scm_async_tick (void);
SCM_API void scm_switch (void);
SCM_API SCM scm_system_async_mark (SCM a);
SCM_API SCM scm_system_async_mark_for_thread (SCM a, SCM thread);
-SCM_INTERNAL int scm_i_setup_sleep (scm_i_thread *,
- scm_i_pthread_mutex_t *m,
- int fd);
-SCM_INTERNAL void scm_i_reset_sleep (scm_i_thread *);
+
+SCM_API int scm_c_prepare_to_wait_on_fd (int fd);
+SCM_API int scm_c_prepare_to_wait_on_cond (scm_i_pthread_mutex_t *m,
+ scm_i_pthread_cond_t *c);
+SCM_API void scm_c_wait_finished (void);
+
SCM_API SCM scm_noop (SCM args);
SCM_API SCM scm_call_with_blocked_asyncs (SCM proc);
SCM_API SCM scm_call_with_unblocked_asyncs (SCM proc);
@@ -45,6 +47,14 @@ SCM_API void *scm_c_call_with_unblocked_asyncs (void *(*p) (void *d), void *d);
SCM_API void scm_dynwind_block_asyncs (void);
SCM_API void scm_dynwind_unblock_asyncs (void);
+SCM_INTERNAL int scm_i_prepare_to_wait (scm_i_thread *,
+ struct scm_thread_wake_data *);
+SCM_INTERNAL void scm_i_wait_finished (scm_i_thread *);
+SCM_INTERNAL int scm_i_prepare_to_wait_on_fd (scm_i_thread *, int);
+SCM_INTERNAL int scm_i_prepare_to_wait_on_cond (scm_i_thread *,
+ scm_i_pthread_mutex_t *,
+ scm_i_pthread_cond_t *);
+
SCM_INTERNAL void scm_i_async_push (scm_i_thread *t, SCM proc);
SCM_INTERNAL SCM scm_i_async_pop (scm_i_thread *t);