| Revision 1.7 | Revision 1.8 | 
                | Line 17 | Line 17 | 
            |     // pth related vars pth_t my_id = (pth_t) NULL;
 char my_name[16];           // 64-bit machine use 16 here? 8 is fine on 32bit pc 
 |     // pth related vars pth_t my_id = (pth_t) NULL;
 char my_name[16];           // 64-bit machine use 16 here? 8 is fine on 32bit pc 
 | 
                         |     pth_msgport_t depot;  |     pth_msgport_t depot = NULL;  | 
            |     pth_msgport_t mp; pth_event_t ev;
 pmsg pm_msg;
 |     pth_msgport_t mp; pth_event_t ev;
 pmsg pm_msg;
 | 
            | Line 40 | Line 40 | 
            |     } 
 /* Wait for the depot's message port to become available */
 |     } 
 /* Wait for the depot's message port to become available */
 | 
                         |     while (NULL == (depot = pth_msgport_find(DEPOT)))  |     depot = pth_msgport_find(DEPOT); | 
                         |   |     while (NULL == depot) { | 
            |         pth_yield(NULL); |         pth_yield(NULL); | 
                    |  |         depot = pth_msgport_find(DEPOT);
    }  | 
            |  /*
 * Send an initial "request finished" message to the depot.  This will
 |  /*
 * Send an initial "request finished" message to the depot.  This will
 | 
            | Line 66 | Line 69 | 
            |     ev = pth_event(PTH_EVENT_MSG, mp); for (;;) {
 reqnode* rn;
 |     ev = pth_event(PTH_EVENT_MSG, mp); for (;;) {
 reqnode* rn;
 | 
                    |  |         struct timeval t1, t2;  | 
            |  /* Wait for a request to be dispatched to us */
 pth_wait(ev);
 |  /* Wait for a request to be dispatched to us */
 pth_wait(ev);
 | 
                         |   |           | 
            |         /* Get the request message from our message port */ pp_msg = (pmsg *) pth_msgport_get(mp);
 assert(pp_msg != NULL);
 
 |         /* Get the request message from our message port */ pp_msg = (pmsg *) pth_msgport_get(mp);
 assert(pp_msg != NULL);
 
 | 
                         |         /* Extract the file descriptor */  |         /* Extract the file descriptor / transaction buffer */ | 
                         |   | #ifdef USE_TCPCORK | 
            |         req_msg.fdp = pp_msg->fd; |         req_msg.fdp = pp_msg->fd; | 
                    |  | #else
        req_msg.fdp = pp_msg->buf;
#endif  | 
            |  /* We're done with the pmsg structure now; return it to the pool */
 rn = (reqnode*)pp_msg;
 |  /* We're done with the pmsg structure now; return it to the pool */
 rn = (reqnode*)pp_msg;
 | 
            | Line 84 | Line 92 | 
            |  /* Read and process the request */
 ret_val = read_request(&req_msg);
 |  /* Read and process the request */
 ret_val = read_request(&req_msg);
 | 
                    |  |         cow_tot_served++;  | 
            |  /*
 * Send a message to the depot to put this thread back on the 'idle
 |  /*
 * Send a message to the depot to put this thread back on the 'idle
 | 
            | Line 99 | Line 108 | 
            |     return _arg; }
 
 |     return _arg; }
 
 | 
                    | /*
 * handler is per thread spawned for each request.
 * This is still here just for ref or debug purpose.
 */
#if 0
void *handler(void *_arg)
{
    int fd = (int)((long)_arg);
    int msgsize;
    msg req_msg;
    msg *new_req_msg;
    req_msg.fdp = fd;
    msgsize = read_request(&req_msg);
    printf("read_request() returned %d\n", msgsize);
    // to make sure
/*
  { extern int cow_noof;
  COW_CLOSE(req_msg.fdp)
  COW_CLOSE(req_msg.fdd)
  }
*/
    pth_abort(pth_self());
    pth_exit(NULL);
    return (void *)NULL;
}
#endif /* 0 */
  |  |