Use a separate FIFO pair for server requests that don't need to pass a
file descriptor.
Associate file descriptors with handles on the server side so that we
don't need to pass the fd every time the client wants to use it.

diff --git a/scheduler/thread.c b/scheduler/thread.c
index e894292..afc1a11 100644
--- a/scheduler/thread.c
+++ b/scheduler/thread.c
@@ -91,7 +91,9 @@
     teb->tls_ptr   = teb->tls_array;
     teb->exit_code = STILL_ACTIVE;
     teb->socket    = -1;
-    teb->stack_top = (void *)~0UL;
+    teb->request_fd = -1;
+    teb->reply_fd   = -1;
+    teb->stack_top  = (void *)~0UL;
     teb->StaticUnicodeString.MaximumLength = sizeof(teb->StaticUnicodeBuffer);
     teb->StaticUnicodeString.Buffer = (PWSTR)teb->StaticUnicodeBuffer;
     teb->teb_sel = SELECTOR_AllocBlock( teb, 0x1000, WINE_LDT_FLAGS_DATA|WINE_LDT_FLAGS_32BIT );
@@ -113,6 +115,8 @@
     /* Free the associated memory */
 
     if (teb->socket != -1) close( teb->socket );
+    close( NtCurrentTeb()->request_fd );
+    close( NtCurrentTeb()->reply_fd );
     if (teb->stack_sel) FreeSelector16( teb->stack_sel );
     FreeSelector16( teb->teb_sel );
     if (teb->buffer) munmap( (void *)teb->buffer,
@@ -280,7 +284,7 @@
                             LPTHREAD_START_ROUTINE start, LPVOID param,
                             DWORD flags, LPDWORD id )
 {
-    int socket, handle = -1;
+    int socket = -1, handle = -1;
     TEB *teb;
     void *tid = 0;
 
@@ -290,10 +294,11 @@
 
         req->suspend = ((flags & CREATE_SUSPENDED) != 0);
         req->inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle);
-        if (!server_call_fd( REQ_NEW_THREAD, -1, &socket ))
+        if (!server_call( REQ_NEW_THREAD ))
         {
             handle = req->handle;
             tid = req->tid;
+            socket = wine_server_recv_fd( handle, 0 );
         }
     }
     SERVER_END_REQ;