mturk       2005/04/18 06:53:33

  Modified:    jni/native/src poll.c
  Log:
  Instead returning file desriptors, return socket, events and client data in
  array offset.
  
  Revision  Changes    Path
  1.7       +9 -5      jakarta-tomcat-connectors/jni/native/src/poll.c
  
  Index: poll.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/poll.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- poll.c    18 Apr 2005 12:33:42 -0000      1.6
  +++ poll.c    18 Apr 2005 13:53:33 -0000      1.7
  @@ -212,12 +212,15 @@
       if (rv != APR_SUCCESS)
           return (jint)(-rv);
       rv = apr_pollset_poll(p->pollset, J2T(timeout), &num, &fd);
  +    apr_thread_mutex_lock(p->mutex);
       if (rv != APR_SUCCESS)
           num = 0;
   
       if (num > 0) {
           for (i = 0; i < num; i++) {
  -            pset[i] = P2J(fd);
  +            pset[i*4+0] = (jlong)(fd->rtnevents);
  +            pset[i*4+1] = P2J(fd->desc.s);
  +            pset[i*4+2] = P2J(fd->client_data);
               fd ++;
           }
       }
  @@ -227,18 +230,19 @@
           /* TODO: Add thread mutex protection
            * or make sure the Java part is synchronized.
            */
  -        apr_thread_mutex_lock(p->mutex);
           for (n = 0; n < p->nelts; n++) {
               if ((now - p->query_ttl[n]) > p->max_ttl) {
                   p->query_set[n].rtnevents = APR_POLLHUP | APR_POLLIN;
  -                if (i < p->nelts) {
  -                    pset[i++] = P2J(&(p->query_set[n]));
  +                if (num < p->nelts) {
  +                    pset[num*4+0] = (jlong)(p->query_set[n].rtnevents);
  +                    pset[num*4+1] = P2J(p->query_set[n].desc.s);
  +                    pset[num*4+2] = P2J(p->query_set[n].client_data);
                       num++;
                   }
               }
           }
  -        apr_thread_mutex_unlock(p->mutex);
       }
  +    apr_thread_mutex_unlock(p->mutex);
       if (num)
           (*e)->ReleaseLongArrayElements(e, set, pset, 0);
       else
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to