mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-24 20:30:28 +02:00
* threads.h, async.h, threads.c (SCM_CRITICAL_SECTION_START,
SCM_CRITICAL_SECTION_END): Moved here from threads.h since now they also block/unblock execution of asyncs and call scm_async_click which is declared in async.h but threads.h can not include async.h since async.h already includes threads.h. (scm_i_critical_section_level): New, for checking mistakes in the use of the SCM_CRITICAL_SECTION_* macros. (scm_i_critical_section_mutex): Make it a recursive mutex so that critical sections can be nested. * threads.h, threads.c (scm_frame_lock_mutex): New. (scm_frame_critical_section): Take mutex as argument. (framed_critical_section_mutex): New, used as default for above. (scm_init_threads): Initialize it. (scm_threads_prehistory): Do not initialize thread_admin_mutex and scm_i_critical_section_mutex; both are initialized statically.
This commit is contained in:
parent
673ba2da04
commit
a4d106c70e
3 changed files with 50 additions and 18 deletions
|
@ -132,18 +132,6 @@ SCM_API void *scm_with_guile (void *(*func)(void *), void *data);
|
|||
SCM_API void *scm_i_with_guile_and_parent (void *(*func)(void *), void *data,
|
||||
SCM parent);
|
||||
|
||||
/* Critical sections */
|
||||
|
||||
/* XXX - every critical section needs to be examined and protected
|
||||
with scm_frame_critical_section, say.
|
||||
*/
|
||||
|
||||
extern scm_i_pthread_mutex_t scm_i_critical_section_mutex;
|
||||
|
||||
#define SCM_CRITICAL_SECTION_START \
|
||||
scm_i_pthread_mutex_lock (&scm_i_critical_section_mutex)
|
||||
#define SCM_CRITICAL_SECTION_END \
|
||||
scm_i_pthread_mutex_unlock (&scm_i_critical_section_mutex)
|
||||
|
||||
extern int scm_i_thread_go_to_sleep;
|
||||
|
||||
|
@ -174,6 +162,7 @@ SCM_API SCM scm_join_thread (SCM t);
|
|||
SCM_API SCM scm_make_mutex (void);
|
||||
SCM_API SCM scm_make_recursive_mutex (void);
|
||||
SCM_API SCM scm_lock_mutex (SCM m);
|
||||
SCM_API void scm_frame_lock_mutex (SCM mutex);
|
||||
SCM_API SCM scm_try_mutex (SCM m);
|
||||
SCM_API SCM scm_unlock_mutex (SCM m);
|
||||
|
||||
|
@ -190,7 +179,7 @@ SCM_API SCM scm_all_threads (void);
|
|||
SCM_API int scm_c_thread_exited_p (SCM thread);
|
||||
SCM_API SCM scm_thread_exited_p (SCM thread);
|
||||
|
||||
SCM_API void scm_frame_critical_section (void);
|
||||
SCM_API void scm_frame_critical_section (SCM mutex);
|
||||
|
||||
#define SCM_I_CURRENT_THREAD \
|
||||
((scm_i_thread *) scm_i_pthread_getspecific (scm_i_thread_key))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue