The following code leaks a thread, but I can't figure out why.  I'm
sure it is something stupid on my part but I having trouble figuring
out what I have done wrong.  Can someone take a look and point me in
the right direction?  I'm running this on windows if that make a
difference.

Thanks,
Steve

USING: accessors destructors fry io io.monitors kernel models prettyprint
threads tools.threads ;
IN: leak


TUPLE: leak < model  name monitor temp ;


: (monitor-loop) ( leak -- leak )
    dup monitor>> next-change path>> >>temp (monitor-loop) ;

: monitor-loop ( leak -- quot )
    '[ _ '[ _ (monitor-loop) drop ] with-monitors ] ;

: start-monitor ( leak -- )
    [ monitor-loop ] [ name>> ] bi spawn drop ;

: (start-leak) ( leak -- )
    "/tmp" f <monitor> >>monitor start-monitor ;

: start-leak ( leak -- leak )
    dup monitor>> [ dup (start-leak) ] unless ;

: stop-leak ( leak -- )
    monitor>> [ dispose ] when* ;


: <leak> ( name -- model ) f leak new-model  swap >>name  start-leak ;


: show-leak ( -- )
    nl "Before creating monitor" print threads.
    "some-name" <leak>
    nl "After monitor created" print threads.
    stop-leak
    yield ! give the monitor a chance to shut down
    nl "Show leaked thread" print threads. ;

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to