factor/extra/concurrency/conditions/conditions.factor

14 lines
446 B
Factor
Raw Normal View History

2008-02-18 10:08:59 -05:00
! Copyright (C) 2005, 2008 Chris Double, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: dlists threads kernel arrays sequences ;
IN: concurrency.conditions
: notify-1 ( dlist -- )
dup dlist-empty? [ pop-back resume ] [ drop ] if ;
: notify-all ( dlist -- )
[ second resume ] dlist-slurp yield ;
: wait ( queue timeout -- queue timeout )
[ 2array swap push-front ] suspend 3drop ; inline