Allow the user to provide a C function that is called on each thread the RTS creates before running any Haskell code
Currently, it is very difficult to use the MySQL/MariaDB client library with Haskell. One must use bound threads, which comes at a performance penalty. The reason is that the underlying library requires a certain initialization function to be called on each OS thread before any other functions are called.
Similarly, it is difficult to optimally use libcurl with GHC. The best-performing way to use libcurl is to have one multi handle per thread and to use curl_multi_socket_action
to respond to events. This is currently not possible from Haskell, at least not easily.
(There are other issues with using libcurl from Haskell; most notably libcurl’s event support makes heavy use of callbacks, which are slow, to tell the application which file descriptors to wait for. But that is a separate issue.)
Setting milestone to 8.4.1 because I don’t think that this is difficult.
This is a feature request.