* async.h (scm_mask_ints): Removed left over reference to
[bpt/guile.git] / libguile / async.h
1 /* classes: h_files */
2
3 #ifndef SCM_ASYNC_H
4 #define SCM_ASYNC_H
5
6 /* Copyright (C) 1995,1996,1997,1998,2000,2001, 2002, 2004, 2005 Free Software Foundation, Inc.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23 \f
24
25 #include "libguile/__scm.h"
26 #include "libguile/root.h"
27 #include "libguile/threads.h"
28
29 \f
30
31 #define scm_mask_ints (SCM_I_CURRENT_THREAD->block_asyncs != 0)
32
33 \f
34
35 SCM_API void scm_async_click (void);
36 SCM_API void scm_switch (void);
37 SCM_API SCM scm_async (SCM thunk);
38 SCM_API SCM scm_async_mark (SCM a);
39 SCM_API SCM scm_system_async_mark (SCM a);
40 SCM_API SCM scm_system_async_mark_for_thread (SCM a, SCM thread);
41 SCM_API void scm_i_queue_async_cell (SCM cell, scm_i_thread *);
42 SCM_API int scm_i_setup_sleep (scm_i_thread *,
43 SCM obj, scm_i_pthread_mutex_t *m, int fd);
44 SCM_API void scm_i_reset_sleep (scm_i_thread *);
45 SCM_API SCM scm_run_asyncs (SCM list_of_a);
46 SCM_API SCM scm_noop (SCM args);
47 SCM_API SCM scm_call_with_blocked_asyncs (SCM proc);
48 SCM_API SCM scm_call_with_unblocked_asyncs (SCM proc);
49 void *scm_c_call_with_blocked_asyncs (void *(*p) (void *d), void *d);
50 void *scm_c_call_with_unblocked_asyncs (void *(*p) (void *d), void *d);
51 void scm_frame_block_asyncs (void);
52 void scm_frame_unblock_asyncs (void);
53
54 /* Critical sections */
55
56 /* XXX - every critical section needs to be examined whether the
57 requirements for SCM_CRITICAL_SECTION_START/END are fulfilled. See
58 the manual.
59 */
60
61 /* Defined in threads.c. scm_i_critical_section_level is only used
62 for error checking and will go away eventually. */
63 extern scm_i_pthread_mutex_t scm_i_critical_section_mutex;
64 extern int scm_i_critical_section_level;
65
66 #define SCM_CRITICAL_SECTION_START \
67 do { \
68 scm_i_pthread_mutex_lock (&scm_i_critical_section_mutex);\
69 SCM_I_CURRENT_THREAD->block_asyncs++; \
70 scm_i_critical_section_level++; \
71 } while (0)
72 #define SCM_CRITICAL_SECTION_END \
73 do { \
74 scm_i_critical_section_level--; \
75 SCM_I_CURRENT_THREAD->block_asyncs--; \
76 scm_i_pthread_mutex_unlock (&scm_i_critical_section_mutex); \
77 scm_async_click (); \
78 } while (0)
79
80 SCM_API void scm_init_async (void);
81
82 #if (SCM_ENABLE_DEPRECATED == 1)
83
84 SCM_API SCM scm_system_async (SCM thunk);
85 SCM_API SCM scm_unmask_signals (void);
86 SCM_API SCM scm_mask_signals (void);
87
88 #endif
89
90 #endif /* SCM_ASYNC_H */
91
92 /*
93 Local Variables:
94 c-file-style: "gnu"
95 End:
96 */