manpagez: man pages & more
info bigloo
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

17.3.5 SRFI-18

SRFI-18 function: mutex-state mutex

Returns information about the state of the mutex. The possible results are:

  • thread T: the mutex is in the locked/owned state and thread T is the owner of the mutex
  • symbol not-owned: the mutex is in the locked/not-owned state
  • symbol abandoned: the mutex is in the unlocked/abandoned state
  • symbol not-abandoned: the mutex is in the unlocked/not-abandoned state

Examples:

(mutex-state (make-mutex))  
   ⇒ not-abandoned

(define (thread-alive? thread)
   (let ((mutex (make-mutex)))
      (mutex-lock! mutex #f thread)
      (let ((state (mutex-state mutex)))
         (mutex-unlock! mutex) ; avoid space leak
         (eq? state thread))))


This document was generated on March 31, 2014 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.