<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Racket threads are green or user
threads, they are not scheduled by the operating system.<br>
Blocking on a socket in XNextEvent blocks the entire Racket VM.<br>
<br>
<br>
You need to use XConnectionNumber to get the X socket file
descriptor number and then create a port that you can sync on with
Racket's sync functionality.<br>
<br>
I'm not sure how you would create the port using the ffi.<br>
<br>
See<br>
<a class="moz-txt-link-freetext" href="http://fixunix.com/xwindows/91558-xconnectionnumber-select.html">http://fixunix.com/xwindows/91558-xconnectionnumber-select.html</a>.<br>
<br>
Kevin<br>
<br>
On 11/07/2012 09:58 AM, Laurent wrote:<br>
</div>
<blockquote
cite="mid:CABNTSaGv0B0bcnoPXjWVAmFs5phWQD7Egv3ReiTs2tLFBoFUow@mail.gmail.com"
type="cite">Hi,<br>
<br>
I don't know if this issue is due to me, Racket, Xlib FFI or Xlib
in itself, but I'm struggling with it. Hopefully someone knows.<br>
<br>
In a multi-threaded application using Jon's Xlib FFI ( <a
moz-do-not-send="true"
href="https://github.com/kazzmir/x11-racket">https://github.com/kazzmir/x11-racket</a>
), I'm using one thread for processing X events with XNextEvent,
which is a blocking call (apparently on a socket).<br>
I have another thread that listens to a tcp port, and does not
need to do any X call.<br>
<br>
The problem is that the second thread blocks on 'read' even if
there is something in the queue to read, unless some X event
unblocks XNextEvent, in which case both threads run, until there
is no X event left (and XNextEvent blocks again).<br>
<br>
I have called XInitThreads prior to any other X call to enable
threads (and the return values says it's ok).<br>
<br>
Any idea anyone?<br>
<br>
Thanks,<br>
Laurent<br>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">____________________
Racket Users list:
<a class="moz-txt-link-freetext" href="http://lists.racket-lang.org/users">http://lists.racket-lang.org/users</a>
</pre>
</blockquote>
<br>
</body>
</html>