[racket] racket and OS threads

From: Jukka Tuominen (jukka.tuominen at finndesign.fi)
Date: Sat Mar 19 17:27:15 EDT 2011

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



Posted on the users mailing list.