I'm writing an interface to libcurl (http://curl.haxx.se/) for scsh,
and I've run into a problem I cannot solve.
It goes as follows: curl has a function (curl_easy_perform) which
performs the HTTP/FTP/whatever transfer, and the first thing this
function does is connect with the remote host. It does it by first
calling connect(), and if it gets an EINPROGRESS error, it does a
select() to wait for the connection to be established.
If curl_easy_perform is called by a stand-alone C program, everything
goes well. If it's called by the scsh VM (through a "call-external"
call), then the call to select() fails with a EINTR error. This aborts
the whole connection, which is of course pretty bad.
Looking at the scsh doc, I read (in section 3.9) this:
The thread system needs the timer interrupt for its own purpose, ...
and I guess (without fully understanding the problem) that the reason
curl's select() gets an EINTR is that it receives some signal used by
the thread system. Am I right?
If yes, is there a solution, or are all libraries which use select()
(or any signal stuff, I presume) fundamentally incompatible with scsh?
Thanks for your help,