Changeset 1473:8784c4181a22


Ignore:
Timestamp:
08/27/10 05:24:32 (18 months ago)
Author:
niam
Branch:
default
Message:

[fcgi] use pc::execution module rather than using pthreads/anything directly

Location:
sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sources/include/libdodo/cgiFastServer.h

    r1439 r1473  
    9595                 * @param data defines the data passed to the thread 
    9696                 */ 
    97                 static void *thread(void *data); 
     97                static int thread(void *data); 
    9898 
    9999                static pc::sync::thread accept;                 ///< accept lock 
  • sources/src/cgiFastServer.cc

    r1464 r1473  
    3333#include <fcgiapp.h> 
    3434 
    35 #ifdef PTHREAD_EXT 
    36 #include <pthread.h> 
    37 #endif 
    38  
    3935#include "cgiFastRequest.inline" 
    4036 
    4137#include <libdodo/cgiFastServer.h> 
    4238#include <libdodo/types.h> 
     39#include <libdodo/pcExecutionThread.h> 
     40#include <libdodo/pcExecutionManager.h> 
    4341#include <libdodo/cgiFastServerEx.h> 
    4442#include <libdodo/cgiFastExchange.h> 
     
    9290//------------------------------------------------------------------- 
    9391 
    94 void * 
     92int 
    9593server::thread(void *data) 
    9694{ 
     
    129127    } 
    130128 
    131     return NULL; 
     129    return 0; 
    132130} 
    133131 
     
    142140    handler = func; 
    143141 
    144 #ifdef PTHREAD_EXT 
    145142    if (threading) { 
    146         pthread_t *id = new pthread_t[threadsNum]; 
     143        pc::execution::manager m; 
    147144 
    148         unsigned int i = 0; 
     145        for (unsigned int i = 0; i < threadsNum; ++i) 
     146            m.run(m.add(pc::execution::thread(server::thread, &limit, pc::execution::ON_DESTRUCTION_STOP, false))); 
    149147 
    150         for (; i < threadsNum; ++i) 
    151             pthread_create(&id[i], NULL, server::thread, &limit); 
    152  
    153         for (i = 0; i < threadsNum; ++i) 
    154             pthread_join(id[i], NULL); 
    155  
    156         delete [] id; 
    157     } else 
    158 #endif 
    159     { 
     148        m.wait(); 
     149    } else { 
    160150        unsigned long requests = 0; 
    161151 
Note: See TracChangeset for help on using the changeset viewer.