mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-23 12:00:21 +02:00
Threading changes.
This commit is contained in:
parent
be1b896c82
commit
a54a94b397
34 changed files with 1298 additions and 1127 deletions
|
@ -133,7 +133,7 @@ do { \
|
|||
|
||||
SCM scm_print_state_vtable = SCM_BOOL_F;
|
||||
static SCM print_state_pool = SCM_EOL;
|
||||
SCM_MUTEX (print_state_mutex);
|
||||
pthread_mutex_t print_state_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
#ifdef GUILE_DEBUG /* Used for debugging purposes */
|
||||
|
||||
|
@ -173,13 +173,13 @@ scm_make_print_state ()
|
|||
SCM answer = SCM_BOOL_F;
|
||||
|
||||
/* First try to allocate a print state from the pool */
|
||||
scm_i_plugin_mutex_lock (&print_state_mutex);
|
||||
pthread_mutex_lock (&print_state_mutex);
|
||||
if (!scm_is_null (print_state_pool))
|
||||
{
|
||||
answer = SCM_CAR (print_state_pool);
|
||||
print_state_pool = SCM_CDR (print_state_pool);
|
||||
}
|
||||
scm_i_plugin_mutex_unlock (&print_state_mutex);
|
||||
pthread_mutex_unlock (&print_state_mutex);
|
||||
|
||||
return scm_is_false (answer) ? make_print_state () : answer;
|
||||
}
|
||||
|
@ -197,10 +197,10 @@ scm_free_print_state (SCM print_state)
|
|||
pstate->fancyp = 0;
|
||||
pstate->revealed = 0;
|
||||
pstate->highlight_objects = SCM_EOL;
|
||||
scm_i_plugin_mutex_lock (&print_state_mutex);
|
||||
pthread_mutex_lock (&print_state_mutex);
|
||||
handle = scm_cons (print_state, print_state_pool);
|
||||
print_state_pool = handle;
|
||||
scm_i_plugin_mutex_unlock (&print_state_mutex);
|
||||
pthread_mutex_unlock (&print_state_mutex);
|
||||
}
|
||||
|
||||
SCM
|
||||
|
@ -692,13 +692,13 @@ scm_prin1 (SCM exp, SCM port, int writingp)
|
|||
else
|
||||
{
|
||||
/* First try to allocate a print state from the pool */
|
||||
scm_i_plugin_mutex_lock (&print_state_mutex);
|
||||
pthread_mutex_lock (&print_state_mutex);
|
||||
if (!scm_is_null (print_state_pool))
|
||||
{
|
||||
handle = print_state_pool;
|
||||
print_state_pool = SCM_CDR (print_state_pool);
|
||||
}
|
||||
scm_i_plugin_mutex_unlock (&print_state_mutex);
|
||||
pthread_mutex_unlock (&print_state_mutex);
|
||||
if (scm_is_false (handle))
|
||||
handle = scm_list_1 (make_print_state ());
|
||||
pstate_scm = SCM_CAR (handle);
|
||||
|
@ -715,10 +715,10 @@ scm_prin1 (SCM exp, SCM port, int writingp)
|
|||
|
||||
if (scm_is_true (handle) && !pstate->revealed)
|
||||
{
|
||||
scm_i_plugin_mutex_lock (&print_state_mutex);
|
||||
pthread_mutex_lock (&print_state_mutex);
|
||||
SCM_SETCDR (handle, print_state_pool);
|
||||
print_state_pool = handle;
|
||||
scm_i_plugin_mutex_unlock (&print_state_mutex);
|
||||
pthread_mutex_unlock (&print_state_mutex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue