Oops, I'd meant to copy the list.

On Wed, Sep 2, 2015 at 6:46 PM, Greg Hendershott
<greghendersh...@gmail.com> wrote:
> Thanks for the quick reply!
>
> On Wed, Sep 2, 2015 at 5:28 PM, Matthew Flatt <mfl...@cs.utah.edu> wrote:
>> That looks like a bug in the scheduler to me. I don't think it's
>> specific to `custodian-box`, but to `sync` and any event that is not
>> ultimately backed by a channel or semaphore. (For example, `alarm-evt`
>> also seems to trigger the problem.)
>
> With that hint, I tried adding a level of indirection -- a thread that
> can sync on the custodian box, and put to a new, additional channel:
>
>   (define repl-cust-box-channel (make-channel))
>   (define repl-cust-box-thread (thread (λ ()
>                                          (let loop ()
>                                            (sync repl-cust-box)
>                                            (channel-put repl-cust-box-channel
>                                                         'memory-limit)
>                                            (loop)))))
>
> That way the main sync can be on two events backed by channels:
>
>        (match (sync the-channel repl-cust-box-channel)
>          ['memory-limit
>           (displayln "Exceeded memory limit")
>           'stop]
>          [msg msg])
>
> And that seems to do the trick, at least in my distilled example.  I
> do want to test in the real/full code, as well as think about any
> lurking gotchas.  (Also, come to think of it, I can probably use the
> one channel for both purposes.)
>
> Even if there's a scheduler bug that you might fix, I'm happy if there
> is some work-around like this, because racket-mode is still aiming to
> support Racket versions as old as 5.3.5.
>
> Thanks again.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to