[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Thread safe hash tables?

From: Thomas Chust
Subject: Re: [Chicken-users] Thread safe hash tables?
Date: Sun, 5 Mar 2006 13:49:12 +0000 (GMT)

On Sat, 4 Mar 2006, KonLovett wrote:

On Mar 4, 2006, at 1:05 PM, Thomas Chust wrote:

Maybe a macro like this one should be added to CHICKEN:

    (define-macro (with-locked-mutex-specific mtx proc)
      (let ((mtx-var (gensym 'mtx)))
        `(let ((,mtx-var mtx))
        (lambda () (mutex-lock! ,mtx-var))
        (lambda () (,proc (mutex-specific ,mtx-var)))
        (lambda () (mutex-unlock! ,mtx-var))))))

I've used something like that every second time I wrote a multithreaded program in CHICKEN so I think it could be useful as a standard extension ;)

Yes. Maybe:

(define-macro (call/synch MTX PROC)
(define-macro (apply/synch MTX PROC . REST)
(define-macro (synch MTX . BODY)

That looks like a useful API, yes.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]