src/solaris/native/java/net/linux_close.c

Print this page




  95 
  96     /*
  97      * Setup the signal handler
  98      */
  99     sa.sa_handler = sig_wakeup;
 100     sa.sa_flags   = 0;
 101     sigemptyset(&sa.sa_mask);
 102     sigaction(sigWakeup, &sa, NULL);
 103 
 104     sigemptyset(&sigset);
 105     sigaddset(&sigset, sigWakeup);
 106     sigprocmask(SIG_UNBLOCK, &sigset, NULL);
 107 }
 108 
 109 /*
 110  * Return the fd table for this fd or NULL is fd out
 111  * of range.
 112  */
 113 static inline fdEntry_t *getFdEntry(int fd)
 114 {
 115     if (fd < 0 || fd > fdCount) {
 116         return NULL;
 117     }
 118     return &fdTable[fd];
 119 }
 120 
 121 /*
 122  * Start a blocking operation :-
 123  *    Insert thread onto thread list for the fd.
 124  */
 125 static inline void startOp(fdEntry_t *fdEntry, threadEntry_t *self)
 126 {
 127     self->thr = pthread_self();
 128     self->intr = 0;
 129 
 130     pthread_mutex_lock(&(fdEntry->lock));
 131     {
 132         self->next = fdEntry->threads;
 133         fdEntry->threads = self;
 134     }
 135     pthread_mutex_unlock(&(fdEntry->lock));




  95 
  96     /*
  97      * Setup the signal handler
  98      */
  99     sa.sa_handler = sig_wakeup;
 100     sa.sa_flags   = 0;
 101     sigemptyset(&sa.sa_mask);
 102     sigaction(sigWakeup, &sa, NULL);
 103 
 104     sigemptyset(&sigset);
 105     sigaddset(&sigset, sigWakeup);
 106     sigprocmask(SIG_UNBLOCK, &sigset, NULL);
 107 }
 108 
 109 /*
 110  * Return the fd table for this fd or NULL is fd out
 111  * of range.
 112  */
 113 static inline fdEntry_t *getFdEntry(int fd)
 114 {
 115     if (fd < 0 || fd >= fdCount) {
 116         return NULL;
 117     }
 118     return &fdTable[fd];
 119 }
 120 
 121 /*
 122  * Start a blocking operation :-
 123  *    Insert thread onto thread list for the fd.
 124  */
 125 static inline void startOp(fdEntry_t *fdEntry, threadEntry_t *self)
 126 {
 127     self->thr = pthread_self();
 128     self->intr = 0;
 129 
 130     pthread_mutex_lock(&(fdEntry->lock));
 131     {
 132         self->next = fdEntry->threads;
 133         fdEntry->threads = self;
 134     }
 135     pthread_mutex_unlock(&(fdEntry->lock));