1 #ifndef SCM_ASYNC_H 2 #define SCM_ASYNC_H 3 4 /* Copyright 1995-1998,2000-2002,2004-2006,2008-2009,2011,2014,2018 5 Free Software Foundation, Inc. 6 7 This file is part of Guile. 8 9 Guile is free software: you can redistribute it and/or modify it 10 under the terms of the GNU Lesser General Public License as published 11 by the Free Software Foundation, either version 3 of the License, or 12 (at your option) any later version. 13 14 Guile is distributed in the hope that it will be useful, but WITHOUT 15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 17 License for more details. 18 19 You should have received a copy of the GNU Lesser General Public 20 License along with Guile. If not, see 21 <https://www.gnu.org/licenses/>. */ 22 23 24 25 #include "libguile/threads.h" 26 27 28 29 #define SCM_TICK scm_async_tick () 30 31 32 33 SCM_API void scm_async_tick (void); 34 SCM_API void scm_switch (void); 35 SCM_API SCM scm_system_async_mark (SCM a); 36 SCM_API SCM scm_system_async_mark_for_thread (SCM a, SCM thread); 37 38 SCM_API int scm_c_prepare_to_wait_on_fd (int fd); 39 SCM_API int scm_c_prepare_to_wait_on_cond (scm_i_pthread_mutex_t *m, 40 scm_i_pthread_cond_t *c); 41 SCM_API void scm_c_wait_finished (void); 42 43 SCM_API SCM scm_noop (SCM args); 44 SCM_API SCM scm_call_with_blocked_asyncs (SCM proc); 45 SCM_API SCM scm_call_with_unblocked_asyncs (SCM proc); 46 SCM_API void *scm_c_call_with_blocked_asyncs (void *(*p) (void *d), void *d); 47 SCM_API void *scm_c_call_with_unblocked_asyncs (void *(*p) (void *d), void *d); 48 SCM_API void scm_dynwind_block_asyncs (void); 49 SCM_API void scm_dynwind_unblock_asyncs (void); 50 51 SCM_INTERNAL int scm_i_prepare_to_wait (scm_thread *, 52 struct scm_thread_wake_data *); 53 SCM_INTERNAL void scm_i_wait_finished (scm_thread *); 54 SCM_INTERNAL int scm_i_prepare_to_wait_on_fd (scm_thread *, int); 55 SCM_INTERNAL int scm_i_prepare_to_wait_on_cond (scm_thread *, 56 scm_i_pthread_mutex_t *, 57 scm_i_pthread_cond_t *); 58 59 SCM_INTERNAL void scm_i_async_push (scm_thread *t, SCM proc); 60 SCM_INTERNAL SCM scm_i_async_pop (scm_thread *t); 61 62 SCM_INTERNAL void scm_init_async (void); 63 64 #endif /* SCM_ASYNC_H */ 65