Removed genereating of FCGI.xs
[catagits/fcgi2.git] / examples / threaded.c
index 1200bad..3e860ec 100755 (executable)
@@ -3,7 +3,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: threaded.c,v 1.5 1999/08/05 14:18:35 roberts Exp $";
+static const char rcsid[] = "$Id: threaded.c,v 1.9 2001/11/20 03:23:21 robs Exp $";
 #endif /* not lint */
 
 #include "fcgi_config.h"
@@ -15,10 +15,6 @@ static const char rcsid[] = "$Id: threaded.c,v 1.5 1999/08/05 14:18:35 roberts E
 #include <unistd.h>
 #endif
 
-#ifdef _WIN32
-#include <process.h>
-#endif
-
 #include "fcgiapp.h"
 
 
@@ -31,11 +27,9 @@ static void *doit(void *a)
     int rc, i, thread_id = (int)a;
     pid_t pid = getpid();
     FCGX_Request request;
-    FCGX_Stream *in, *out, *err;
-    FCGX_ParamArray envp;
     char *server_name;
 
-    FCGX_InitRequest(&request);
+    FCGX_InitRequest(&request, 0, 0);
 
     for (;;)
     {
@@ -44,15 +38,15 @@ static void *doit(void *a)
 
         /* Some platforms require accept() serialization, some don't.. */
         pthread_mutex_lock(&accept_mutex);
-        rc = FCGX_Accept_r(&in, &out, &err, &envp, &request);
+        rc = FCGX_Accept_r(&request);
         pthread_mutex_unlock(&accept_mutex);
 
         if (rc < 0)
             break;
 
-        server_name = FCGX_GetParam("SERVER_NAME", envp);
+        server_name = FCGX_GetParam("SERVER_NAME", request.envp);
 
-        FCGX_FPrintF(out,
+        FCGX_FPrintF(request.out,
             "Content-type: text/html\r\n"
             "\r\n"
             "<title>FastCGI Hello! (multi-threaded C, fcgiapp library)</title>"
@@ -66,7 +60,7 @@ static void *doit(void *a)
         pthread_mutex_lock(&counts_mutex);
         ++counts[thread_id];
         for (i = 0; i < THREAD_COUNT; i++)
-            FCGX_FPrintF(out, "%5d " , counts[i]);
+            FCGX_FPrintF(request.out, "%5d " , counts[i]);
         pthread_mutex_unlock(&counts_mutex);
 
         FCGX_Finish_r(&request);
@@ -87,6 +81,6 @@ int main(void)
 
     doit(0);
 
-    exit(0);
+    return 0;
 }