[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pthread fast mutexes
From: |
Mikael Djurfeldt |
Subject: |
Re: pthread fast mutexes |
Date: |
Mon, 23 Feb 2004 17:22:47 -0500 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
Mikael Djurfeldt <address@hidden> writes:
> Therefore, fast mutexes are consistent with the requirements of the
> interface, and they are, well, fast...
Actually, there's more to it than that:
Guile has two kinds of mutexes:
1. The ones you get with (make-mutex)
These are efficient. They are also used internally and in the
application C API. Therefore, any speed penalty on these will have
a global effect on all programs in a Guile with threading
activated. I actually did a benchmark between fast and normal
mutexes and there is a significant difference in run-time for
non-threaded programs in such a Guile.
2. The ones you get with (make-fair-mutex)
These are fair, recursive and error checking.
Simply put: These are the mutexes with all bells and whistles.
Try (unlock-mutex (make-fair-mutex))
Given that we really need very efficient mutexes in Guile internals,
and that one probably would like to be able to use these from the
Scheme level if we also provide a "safe" alternative, I really
wouldn't like to abstain from the "fast" mutexes of pthreads.
If people think it is a really bad idea not to have better error
checking on the mutexes you get from (make-mutex), one possibility is
to make the following name substitutions:
make-mutex --> make-fast-mutex
make-fair-mutex --> make-mutex
M