Re: [racket-users] Sync on Distributed Place Channels

2015-08-30 Thread David T. Pierson
On Sun, Aug 30, 2015 at 06:28:24AM -0600, Matthew Flatt wrote:
> At Sun, 30 Aug 2015 08:19:22 -0400, "David T. Pierson" wrote:
> > I can duplicate the behavior.  It seems like a bug.
> 
> A place doubles as a pace channel, but `sync` on a place is like
> `place-wait`, not like `place-channel-get`.

Ah, makes sense now.  Thanks.

David

-- 
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.


Re: [racket-users] Sync on Distributed Place Channels

2015-08-30 Thread Matthew Flatt
At Sun, 30 Aug 2015 08:19:22 -0400, "David T. Pierson" wrote:
> On Mon, Aug 24, 2015 at 10:45:11AM -0700, Konstantin Weitz wrote:
> > I'm trying to receive messages from a place. Receiving the messages
> > with `place-channel-get` works fine, but using `sync` blocks
> > indefinitely. I want to use `sync` instead of `place-channel-get` to
> > check multiple channels simultaneously for messages.
> 
> Seems no one has responded to this?
> 
> I can duplicate the behavior.  It seems like a bug.

A place doubles as a pace channel, but `sync` on a place is like
`place-wait`, not like `place-channel-get`.

There should be a way to wrap a place and get an event that acts like
`place-channel-get` --- but I don't think there is one. I'll add that.

Meanwhile, I think you'll have to create an extra place channel after
starting the place to get a value that works the way you want with
`sync`.

-- 
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.


Re: [racket-users] Sync on Distributed Place Channels

2015-08-30 Thread David T. Pierson
On Mon, Aug 24, 2015 at 10:45:11AM -0700, Konstantin Weitz wrote:
> I'm trying to receive messages from a place. Receiving the messages
> with `place-channel-get` works fine, but using `sync` blocks
> indefinitely. I want to use `sync` instead of `place-channel-get` to
> check multiple channels simultaneously for messages.

Seems no one has responded to this?

I can duplicate the behavior.  It seems like a bug.

My `racket --version' shows:

Welcome to Racket v6.2.900.11.

David

-- 
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.


[racket-users] Sync on Distributed Place Channels

2015-08-24 Thread Konstantin Weitz
I'm trying to receive messages from a place. Receiving the messages with 
`place-channel-get` works fine, but using `sync` blocks indefinitely. I want to 
use `sync` instead of `place-channel-get` to check multiple channels 
simultaneously for messages.

Below is an example that demonstrates the problem. What am I doing wrong? Am I 
using `sync` incorrectly? Does `sync` not work with channels?

(module hello-world racket
  (require racket/place/distributed racket/place)
  (provide world)

  (define (world ch)
(define s (place-channel-get ch))
(place-channel-put ch (string-append s "World!\n")))

  (module+ main
(define nd (create-place-node "localhost" #:listen-port 1234))
(define ch (dynamic-place #:at nd (quote-module-path "..") 'world))
(place-channel-put ch "Hello ")
  ; (define rs (place-channel-get ch)); works
(define rs (sync ch))   ; block indefinitely
(write-string rs)))

-- 
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.