joel
2019-10-19 16:12:21

I’m nowhere near on your level but this was a great post and I loved your Dante quote


spdegabrielle
2019-10-19 17:04:25

Maybe potential game jam entries could use Vulkan with this. https://itch.io/jam/racket-2019-gamejam


steveh2009
2019-10-19 17:35:34

Does anyone know where I can find DrScheme binaries which will still run under Windows 95/NT4/2000? Just nostalgia purposes. I tried http://archive.org\|archive.org, couldn’t get a valid download link (where the file was saved by them). Thanks.


mflatt
2019-10-19 17:36:34

soegaard2
2019-10-19 17:37:38

It seems http://download.plt-scheme.org/ is doesn’t respond.


mflatt
2019-10-19 17:37:45

Yes, I was just noticing that.


mflatt
2019-10-19 17:42:43

I’ve updated the DNS entry. We’ll see if that turns out to be enough.


steveh2009
2019-10-19 17:54:17

If I have an FFI C library that blocks on a socket (accepting/responding to msgs) can I still use a Racket thread to kick that off on its own or is this a special case where I need to use something like places?


soegaard2
2019-10-19 19:00:45

From the Wikipedia page on SICP. Alyssa P. Hacker, a Lisp hacker Ben Bitdiddle, a hardware expert Cy D. Fect, a "reformed C programmer" Eva Lu Ator, an evaluator Lem E. Tweakit, an irate user Louis Reasoner, a loose reasoner Can anyone explain the Alyssa pun?


notjack
2019-10-19 19:08:56

“a lispy hacker” :wink:


soegaard2
2019-10-19 19:09:29

Thanks!


mflatt
2019-10-19 19:47:11

artemchernyak
2019-10-19 19:58:09

@artemchernyak has joined the channel


steveh2009
2019-10-19 20:05:51

Excellent, thanks!


deactivateduser60718
2019-10-19 21:16:41

@spdegabrielle That would be amazing. I’d have to confirm that swap chain/presentation works first. Hopefully I can before the festivities begin


samdphillips
2019-10-19 21:25:27

IIRC if the C library only does blocking io then you will have to put it in a place or it will block the Racket VM.


samdphillips
2019-10-19 21:26:28

If it has some sort of polling construct you can possibly make an event for it and put the poll and call in a Racket thread.


samdphillips
2019-10-19 21:33:28

If you can get the underlying filehandle you can sometimes use that for polling as well.

https://docs.racket-lang.org/foreign/Ports.html


deactivateduser60718
2019-10-19 21:50:04

ffi/unsafe does not provide a _char… Is that to help make sure people use _bytes/nul-terminated?


deactivateduser60718
2019-10-19 21:50:40

I’m just now seeing that I cannot pass a byte string through (_cpointer _int8).


sorawee
2019-10-19 22:15:11

Would be even closer with “Alice”


samth
2019-10-19 22:23:22

mflatt
2019-10-19 22:26:16

I think we should just bring http://download.plt-scheme.org\|download.plt-scheme.org back, and I’ve nudged that along.


steveh2009
2019-10-19 22:30:21

So I can convert the C socket in / out streams (once they’ve been opened on the C side), into something Racket can communicate with, put that on a separate Racket thread and then if the in stream blocks, I won’t freeze up the Racket VM? Right now, I have a partially completed Racket version of the C library where the in stream can block in a Racket thread and the RVM won’t hang.


steveh2009
2019-10-19 22:37:42

I thought I read that there’s only 1 OS thread for running all of Racket. If that’s the case, I don’t know how I’m able to block on the in stream in a Racket thread unless the low level stuff checks for a “would block” before ever attempting a read. Gives the illusion that blocking is going on when it’s really polling underneath that I don’t programmatically see at my software layer?


samdphillips
2019-10-19 22:38:23

You would need to poll the stream for data and then perform the blocking operation. Something like

(sync (handle-evt (unsafe-fd->evt fd 'read #t) (lambda (_ignore) (do-blocking-read))))


samdphillips
2019-10-19 22:39:13

Racket IO is async, so reading a port in one thread doesn’t block others. But if you go into the C world and never get back to the Racket world it will block.


steveh2009
2019-10-19 22:45:05

Thanks for your help!


samth
2019-10-20 00:41:00

I really thought that the ffi had a way to call in a new OS thread, but I can’t find it


samdphillips
2019-10-20 01:00:43

That would be nice.


ryanc
2019-10-20 01:01:23

If you have a file descriptor and you’re really just calling read on it, the simplest thing to do is turn it into a Racket port using unsafe-{file-descriptor,socket}->port, and then Racket will handle reading in a non-blocking, thread-friendly way.


ryanc
2019-10-20 01:08:39

For other blocking calls, like accept, you can use unsafe-poller. (The sync expression that SamPhillips would mostly work, but there’s a race between checking for a ready fd and performing the read.) The implementation of unix-socket-accept-evt is an example of using unsafe-poller.


samdphillips
2019-10-20 01:27:56

Out of curiosity where is the race?


sorawee
2019-10-20 01:36:47

While Racket is waiting for blocking system operations (e.g. system*), can Racket perform aggressive GC or do something else useful?


mflatt
2019-10-20 02:18:12

Calling system* blocks only the calling thread, not any other Racket thread (or place).


mflatt
2019-10-20 02:19:40

The runtime system won’t GC during system* just because it has nothing else to do, but it will perform a GC as usual if other work triggers it.


notjack
2019-10-20 03:31:22

Because I’ve been thinking about how to get http2 support in Racket, here’s a fun http2 fact: on average, the first 40 or so GET requests you send to a server fit in a single TCP packet (around 20 bytes per request). The first 400 or so fit in the ten packets you can send before TCP congestion control requires the client to wait for an ACK before sending more messages (CWND). So when talking to the same server, with http2, there is almost no network overhead to sending individual GET requests instead of one single batch GET request.


notjack
2019-10-20 03:31:40