Lines Matching refs:hi
45 ilb_handle_impl_t *hi = (ilb_handle_impl_t *)h; in i_ilb_socket_set_err() local
49 hi->h_valid = B_FALSE; in i_ilb_socket_set_err()
50 hi->h_error = err; in i_ilb_socket_set_err()
56 ilb_handle_impl_t *hi = NULL; in ilb_open() local
65 hi = calloc(1, sizeof (*hi)); in ilb_open()
66 if (hi == NULL) in ilb_open()
69 if (cond_init(&hi->h_cv, USYNC_THREAD, NULL) != 0) { in ilb_open()
74 if (mutex_init(&hi->h_lock, USYNC_THREAD | LOCK_ERRORCHECK, NULL) in ilb_open()
80 hi->h_busy = B_FALSE; in ilb_open()
104 hi->h_socket = s; in ilb_open()
105 hi->h_valid = B_TRUE; in ilb_open()
112 *hp = (ilb_handle_t)hi; in ilb_open()
114 free(hi); in ilb_open()
123 ilb_handle_impl_t *hi = (ilb_handle_impl_t *)h; in ilb_close() local
128 if (mutex_lock(&hi->h_lock) != 0) in ilb_close()
132 if (hi->h_closing) { in ilb_close()
135 hi->h_closing = B_TRUE; in ilb_close()
136 hi->h_error = ILB_STATUS_HANDLE_CLOSING; in ilb_close()
140 while (hi->h_waiter > 0) { in ilb_close()
141 if (cond_wait(&hi->h_cv, &hi->h_lock) != 0) { in ilb_close()
142 (void) mutex_unlock(&hi->h_lock); in ilb_close()
148 (void) close(hi->h_socket); in ilb_close()
149 (void) mutex_destroy(&hi->h_lock); in ilb_close()
150 (void) cond_destroy(&hi->h_cv); in ilb_close()
151 free(hi); in ilb_close()
175 ilb_handle_impl_t *hi = (ilb_handle_impl_t *)h; in i_ilb_do_comm() local
181 if (mutex_lock(&hi->h_lock) != 0) in i_ilb_do_comm()
184 hi->h_waiter++; in i_ilb_do_comm()
185 while (hi->h_busy) { in i_ilb_do_comm()
186 if (cond_wait(&hi->h_cv, &hi->h_lock) != 0) { in i_ilb_do_comm()
187 hi->h_waiter--; in i_ilb_do_comm()
188 (void) cond_signal(&hi->h_cv); in i_ilb_do_comm()
189 (void) mutex_unlock(&hi->h_lock); in i_ilb_do_comm()
194 if (!hi->h_valid || hi->h_closing) { in i_ilb_do_comm()
195 hi->h_waiter--; in i_ilb_do_comm()
196 (void) cond_signal(&hi->h_cv); in i_ilb_do_comm()
197 (void) mutex_unlock(&hi->h_lock); in i_ilb_do_comm()
198 return (hi->h_error); in i_ilb_do_comm()
201 hi->h_busy = B_TRUE; in i_ilb_do_comm()
202 (void) mutex_unlock(&hi->h_lock); in i_ilb_do_comm()
204 s = hi->h_socket; in i_ilb_do_comm()
224 (void) mutex_lock(&hi->h_lock); in i_ilb_do_comm()
225 hi->h_busy = B_FALSE; in i_ilb_do_comm()
226 hi->h_waiter--; in i_ilb_do_comm()
227 (void) cond_signal(&hi->h_cv); in i_ilb_do_comm()
228 (void) mutex_unlock(&hi->h_lock); in i_ilb_do_comm()