Re: [racket] Some problem with hash-update!

2014-09-14 Thread Matthew Flatt
I think that changing `_pointer` to `_DWORD` can't be the real answer, since `_pointer` is at least as large as `_DWORD`. But I agree that you should use `malloc`, and you should also supply 'atomic-interior: (malloc _DWORD 'atomic-interior) The 'atomic-interior flag ensures that the allocated

Re: [racket] Some problem with hash-update!

2014-09-14 Thread Evgeny Odegov
More complete example: http://pasterack.org/pastes/25901 I guess I've found reason of the problem. I think the problem was in that line: (define lpdwItems (make-bytes (ctype-sizeof _pointer) 0)) I've changed it to: (define lpdwItems (make-bytes (ctype-sizeof _DWORD) 0)) There is no visible prob

Re: [racket] Possible bug involving sync on tcp ports

2014-09-14 Thread Brett Stahlman
On Sun, Sep 14, 2014 at 9:49 AM, Matthew Flatt wrote: > I'll push a repair to make `rnrs/io/ports-6` ports work right with > `sync`. Excellent! Thanks. > > There's not really a way to get the OS-process-level stdin and stdout > in Racket, except by using scheme_make_fd_input_port() via > `ffi/un

Re: [racket] Possible bug involving sync on tcp ports

2014-09-14 Thread Matthew Flatt
I'll push a repair to make `rnrs/io/ports-6` ports work right with `sync`. There's not really a way to get the OS-process-level stdin and stdout in Racket, except by using scheme_make_fd_input_port() via `ffi/unsafe`. The intent is that the initial ports, which correspond to stdin and stdout, can

Re: [racket] Possible bug involving sync on tcp ports

2014-09-14 Thread Brett Stahlman
On Sun, Sep 14, 2014 at 9:23 AM, Matthew Flatt wrote: > I think the problem is in `standard-input-port` from `rnrs/io/ports-6`. > > If you use `current-input-port` instead of `standard-input-port`, does > the client behave correctly? It does indeed! Can't recall why I used standard-input-port to

Re: [racket] Possible bug involving sync on tcp ports

2014-09-14 Thread Matthew Flatt
I think the problem is in `standard-input-port` from `rnrs/io/ports-6`. If you use `current-input-port` instead of `standard-input-port`, does the client behave correctly? At Sun, 14 Sep 2014 08:20:26 -0500, Brett Stahlman wrote: > On Sep 14, 2014 7:56 AM, "Matthew Flatt" wrote: > > > > It's pos

Re: [racket] Possible bug involving sync on tcp ports

2014-09-14 Thread Matthew Flatt
At Sun, 14 Sep 2014 08:20:26 -0500, Brett Stahlman wrote: > I will try to put together > a version to send you, though. Would you prefer it with the debug printf's > stripped out? Either way is fine. Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Possible bug involving sync on tcp ports

2014-09-14 Thread Brett Stahlman
On Sep 14, 2014 7:56 AM, "Matthew Flatt" wrote: > > It's possible that something is wrong with `sync` and TCP ports --- > although the test suite at least includes that combination --- but can > you provide a complete program? > > For example, I'm interested in what `handle-rdy-to-send` does. In t

Re: [racket] Possible bug involving sync on tcp ports

2014-09-14 Thread Matthew Flatt
It's possible that something is wrong with `sync` and TCP ports --- although the test suite at least includes that combination --- but can you provide a complete program? For example, I'm interested in what `handle-rdy-to-send` does. In the part that you show, the function will be triggered when o

Re: [racket] Some problem with hash-update!

2014-09-14 Thread Matthew Flatt
My best guess is that it's an issue with memory management, because memory management gets a lot trickier when you call a function that can call back into Racket. A GC can happen during the callback, and therefore during the dynamic extent of the foreign-function call, which can move arguments that

[racket] Possible bug involving sync on tcp ports

2014-09-14 Thread Brett Stahlman
Hello, I have the following loop in a tcp client program that sends forms typed by user at the terminal to a listening server, and receives such forms typed by other clients (broadcast to all clients by the server). (define server-msg-evt (wrap-evt in handle-server-msg)) (define rdy-to-send-evt (

Re: [racket] Setting umask from within Racket

2014-09-14 Thread Neil Van Dyke
If you don't find exactly the solution you want, possible measures: * If the concern is security, create the files in a directory on which you've set sufficiently restrictive permissions. (Even if you always set the file permissions immediately after opening the file for writing, there could

[racket] Setting umask from within Racket

2014-09-14 Thread Mello, Cody
Hello everyone, Is there a way to set the umask of the process from within Racket? Or to specify the mode of a newly created file? I've been looking through the documentation, but I'm not finding anything along these lines. I was hoping that I could do something like the following from within my p