* Does guile mutexes work in C
@ 2014-04-27 19:22 Stefan Israelsson Tampe
0 siblings, 0 replies; only message in thread
From: Stefan Israelsson Tampe @ 2014-04-27 19:22 UTC (permalink / raw)
To: guile-devel
[-- Attachment #1: Type: text/plain, Size: 878 bytes --]
This works,
pthread_mutex_t gp_gc_lock = PTHREAD_MUTEX_INITIALIZER;
void gp_no_gc()
{
printf("lock\n");
pthread_mutex_lock(&gp_gc_lock);
gp_gc_p ++;
pthread_mutex_unlock(&gp_gc_lock);
printf("unlock\n");
}
void gp_do_gc()
{
printf("lock\n");
pthread_mutex_lock(&gp_gc_lock);
gp_gc_p --;
pthread_mutex_unlock(&gp_gc_lock);
printf("unlock\n");
}
void *gp_after_mark_hook(void *hook_data, void *fn_data, void *data)
{
SCM pt = scm_fluid_ref(gp_stacks);
printf("lock\n");
pthread_mutex_lock(&gp_gc_lock);
if(gp_gc_p)
{
pthread_mutex_unlock(&gp_gc_lock);
printf("unlock\n");
return (void *)0;
}
pthread_mutex_unlock(&gp_gc_lock);
printf("unlock\n");
...
But replacing the pthread versions with guile versions of the mutex result
in the mutex getting into a locked state without leaving. I sthis a known
issue?
/Stefan
[-- Attachment #2: Type: text/html, Size: 1476 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-04-27 19:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-27 19:22 Does guile mutexes work in C Stefan Israelsson Tampe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).