diff options
author | Ken Raeburn <raeburn@raeburn.org> | 2009-08-26 23:30:59 +0100 |
---|---|---|
committer | Neil Jerram <neil@ossau.uklinux.net> | 2009-08-26 23:36:19 +0100 |
commit | 71a5964c110bea93ac926331547c25bdff67ce23 (patch) | |
tree | 3e5286a08863c0136d72553840b0b5b23a4dd52e /libguile/srfi-14.h | |
parent | a66480374ed6dfc2d012c6df39c1382ba87ed9d0 (diff) | |
download | guile-71a5964c110bea93ac926331547c25bdff67ce23.tar.gz |
Don't leave and reenter guile mode if mutex is available
On Aug 5, 2009, at 10:06, Ken Raeburn wrote:
> (1) In scm_pthread_mutex_lock, we leave and re-enter guile mode so
> that we don't block the thread while in guile mode. But we could
> use pthread_mutex_trylock first, and avoid the costs scm_leave_guile
> seems to incur on the Mac. If we can't acquire the lock, it should
> return immediately, and then we can do the expensive, blocking
> version. A quick, hack version of this changed my run time for
> A(3,8) from 17.5s to 14.5s, saving about 17%; sigaltstack and
> sigprocmask are still in the picture, because they're called from
> scm_catch_with_pre_unwind_handler. I'll work up a nicer patch
> later.
Ah, we already had scm_i_pthread_mutex_trylock lying around; that made
things easy.
A second timing test with A(3,9) and this version of the patch (based
on 1.9.1) shows the same improvement.
* libguile/threads.c (scm_pthread_mutex_lock): Try the mutex before
leaving and reentering guile mode.
Diffstat (limited to 'libguile/srfi-14.h')
0 files changed, 0 insertions, 0 deletions