From: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
To: guile-devel <guile-devel@gnu.org>
Subject: Does guile mutexes work in C
Date: Sun, 27 Apr 2014 21:22:46 +0200 [thread overview]
Message-ID: <CAGua6m12oMx5nW1ZiFe5mSvJ0n4RyjZYdBD5pEmiPPzOX=fvSw@mail.gmail.com> (raw)
[-- 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 --]
reply other threads:[~2014-04-27 19:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAGua6m12oMx5nW1ZiFe5mSvJ0n4RyjZYdBD5pEmiPPzOX=fvSw@mail.gmail.com' \
--to=stefan.itampe@gmail.com \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).