[Top][All Lists]

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

[bug #27450] Fat mutexes not GC'd until their owner dies

From: Ludovic Courtès
Subject: [bug #27450] Fat mutexes not GC'd until their owner dies
Date: Mon, 14 Sep 2009 22:32:48 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20090809 IceCat/3.5.2


                 Summary: Fat mutexes not GC'd until their owner dies
                 Project: Guile
            Submitted by: civodul
            Submitted on: Mon 14 Sep 2009 10:32:47 PM GMT
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any




In 1.9.2 and earlier (pre-libgc), the following snippet demonstrates in a few
seconds that threads aren't GC'd, despite the fact that `(all-threads)' shows
the right number of threads:

(use-modules (ice-9 threads))

(let loop ()
  (let* ((m (make-mutex))
         (t (begin
              (lock-mutex m)
              (make-thread (lambda args
                             (lock-mutex m)
    (cancel-thread t)

    (format #t "~A threads~%" (length (all-threads)))


This is because threads here are canceled while waiting in `block_self ()'. 
Threads in `block_self ()' are enqueued in the given queue, which is
associated with the fat mutex.  Cancellation does not give them the
opportunity to get removed from the queue, hence the unbounded data

But the root cause is that mutexes created in this code aren't GC'd, because
they are associated with the calling thread via `t->mutexes'.  One solution
would be to use weak pointers in `t->mutexes'.



Reply to this item at:


  Message sent via/by Savannah

reply via email to

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