[racket] racket and OS threads
Excellent, that did it. Thank you for the _instant_ support, Matthew!
One thing I noticed, is that when pressing the stop button in DrRacket, the OS process survived. I can't tell whether that's good or bad, just an observation.
Thanks again!
br, jukka
> -----Original Message-----
> From: Matthew Flatt [mailto:mflatt at cs.utah.edu]
> Sent: 19 March 2011 23:43
> To: Jukka Tuominen
> Cc: users at racket-lang.org
> Subject: Re: [racket] racket and OS threads
>
>
> That works for me in Mac OS X. For Linux, though, I have to enable
> subprocess groups with `(subprocess-group-enabled #t)'. I guess its a
> difference in how shells work.
>
> At Sat, 19 Mar 2011 23:27:15 +0200, "Jukka Tuominen" wrote:
> >
> > Still can't end the OS process. I wasn't sure where to place the
> > (current-subprocess-custodian-mode 'kill), but none (1-4)
> worked. Is there
> > still hope to have it done from gracket?
> >
> > Here's what I have tried:
> >
> > ;(current-subprocess-custodian-mode 'kill);1
> >
> > (define loop
> > (lambda ()
> > (define cust (make-custodian))
> > (begin ;(current-subprocess-custodian-mode 'kill);2
> > (parameterize ((current-custodian cust)
> > ;(current-subprocess-custodian-mode 'kill);3
> > )
> > (thread (lambda ()
> > (current-subprocess-custodian-mode 'kill);4
> > (system "gracket -f \"...rkt\""))))
> > (display "start")(newline)
> > (sleep 45)
> > (custodian-shutdown-all cust)
> > (display "end")(newline)
> > (sleep 10)
> > (loop)
> > )))
> >
> > br, jukka
> >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Matthew Flatt [mailto:mflatt at cs.utah.edu]
> > > > Sent: 18 March 2011 15:24
> > > > To: Jukka Tuominen
> > > > Cc: users at racket-lang.org
> > > > Subject: Re: [racket] racket and OS threads
> > > >
> > > >
> > > > Oh, you need to create a custodian, make it the current
> custodian when
> > > > creating the thread (with `parameterize' and
> `current-custodian'), and
> > > > then shut down with `custodian-shutdown-all' instead of
> `kill-thread'.
> > > >
> > > > At Fri, 18 Mar 2011 15:17:30 +0200, "Jukka Tuominen" wrote:
> > > > >
> > > > > I tried first the original "system" procedure having
> > > > > (current-subprocess-custodian-mode 'kill) mode applied. But
> > > > that didn't have
> > > > > any effect on kill-thread, and for subprocess-kill I
> should know the
> > > > > subprocess id, I guess?
> > > > >
> > > > > What am I missing here...?
> > > > >
> > > > > br, jukka
> > > > >
> > > > >
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Matthew Flatt [mailto:mflatt at cs.utah.edu]
> > > > > > Sent: 18 March 2011 15:02
> > > > > > To: Jukka Tuominen
> > > > > > Cc: users at racket-lang.org
> > > > > > Subject: Re: [racket] racket and OS threads
> > > > > >
> > > > > >
> > > > > > At Fri, 18 Mar 2011 14:57:34 +0200, "Jukka Tuominen" wrote:
> > > > > > > now the problem moved to converting the simple "system"
> > > > procedure to
> > > > > > > not-so-simple "subprocess" procedure.
> > > > > >
> > > > > > To use `current-subprocess-custodian-mode'? The
> parameter applies to
> > > > > > `system', too.
> > > > > >
> > > > >
> > > > >
> > > > > _________________________________________________
> > > > > For list-related administrative tasks:
> > > > > http://lists.racket-lang.org/listinfo/users
> > > >
> > >
> > >
> > > _________________________________________________
> > > For list-related administrative tasks:
> > > http://lists.racket-lang.org/listinfo/users
> >
> > _________________________________________________
> > For list-related administrative tasks:
> > http://lists.racket-lang.org/listinfo/users
>