Lines Matching refs:pollbase
113 } pollbase = {
237 (void) pthread_mutex_lock(&pollbase.mt);
239 for (i = 0; i < pollbase.list_len; i++) {
240 if (pollbase.list[i]->req_num == *req_num) {
241 ASSERT(pollbase.list[i]->status == PENDING);
243 pollbase.list[i]->status = ARRIVED;
244 pollbase.list[i]->fd = fd;
245 pollbase.list[i]->datalen = payloadsize - prlen;
247 pollbase.pending_count--;
248 (void) pthread_cond_broadcast(&pollbase.cv);
256 if (i < pollbase.list_len) {
257 while (pollbase.list[i]->status == ARRIVED)
258 (void) pthread_cond_wait(&pollbase.cv, &pollbase.mt);
261 (void) pthread_mutex_unlock(&pollbase.mt);
281 (void) pthread_mutex_lock(&pollbase.mt);
283 ASSERT(pollbase.list[index]->req_num == req_num);
285 while (pollbase.list[index]->status == PENDING &&
286 pollbase.doreset == 0 && ier == 0)
287 ier = pthread_cond_timedwait(&pollbase.cv, &pollbase.mt,
291 if (pollbase.doreset == 0) {
292 ASSERT(pollbase.list[index]->status == ARRIVED);
297 *resplen = pollbase.list[index]->datalen +
302 if (read_stream(pollbase.list[index]->fd,
307 pollbase.list[index]->status = UNUSED;
308 pollbase.list[index]->req_num = 0;
309 (void) pthread_cond_broadcast(&pollbase.cv);
311 if (--(pollbase.pending_count) == 0)
312 (void) pthread_cond_broadcast(&pollbase.cv);
316 (void) pthread_mutex_unlock(&pollbase.mt);
327 (void) pthread_mutex_lock(&pollbase.mt);
328 pollbase.nclients++;
329 (void) pthread_mutex_unlock(&pollbase.mt);
336 (void) pthread_mutex_lock(&pollbase.mt);
337 pollbase.nclients--;
338 ASSERT(pollbase.nclients >= 0);
339 (void) pthread_mutex_unlock(&pollbase.mt);
348 (void) pthread_mutex_lock(&pollbase.mt);
349 pollbase.pending_count++;
352 for (i = 0; i < pollbase.list_len; i++) {
353 if (pollbase.list[i]->status == UNUSED) {
354 pollbase.list[i]->status = PENDING;
355 pollbase.list[i]->req_num = req_num;
356 pollbase.list[i]->datalen = 0;
373 ASSERT(pollbase.list_len < pollbase.nclients + 1);
375 newlen = pollbase.list_len + 5;
379 for (i = 0; i < pollbase.list_len; i++)
380 newlist[i] = pollbase.list[i];
382 oldlist = pollbase.list;
383 pollbase.list = newlist;
384 ldom_free(oldlist, pollbase.list_len *
387 for (i = pollbase.list_len; i < newlen; i++) {
388 pollbase.list[i] =
390 pollbase.list[i]->status = UNUSED;
393 pollbase.list_len = newlen;
397 (void) pthread_mutex_unlock(&pollbase.mt);
407 (void) pthread_mutex_lock(&pollbase.mt);
409 ASSERT(pollbase.list[index]->req_num == req_num);
410 pollbase.list[index]->status = UNUSED;
412 if (--(pollbase.pending_count) == 0 && pollbase.doreset == 1)
413 (void) pthread_cond_broadcast(&pollbase.cv);
415 (void) pthread_mutex_unlock(&pollbase.mt);
422 (void) pthread_mutex_lock(&pollbase.mt);
424 pollbase.doexit = 1;
426 (void) pthread_mutex_unlock(&pollbase.mt);
433 (void) write(pollbase.notify_pipe[0], "1", 1);
434 (void) pthread_join(pollbase.polling_tid, NULL);
456 (void) pthread_mutex_lock(&pollbase.mt);
458 if (pollbase.doexit) {
459 (void) pthread_mutex_unlock(&pollbase.mt);
463 if (pollbase.doreset) {
466 while (pollbase.pending_count > 0)
467 (void) pthread_cond_wait(&pollbase.cv,
468 &pollbase.mt);
470 ASSERT(pollbase.pending_count == 0);
471 for (i = 0; i < pollbase.list_len; i++)
472 pollbase.list[i]->status = UNUSED;
474 pollbase.doreset = 0;
477 (void) pthread_mutex_unlock(&pollbase.mt);
489 pipe_fd->fd = pollbase.notify_pipe[1]; /* notification pipe */
498 (void) pthread_mutex_lock(&pollbase.mt);
499 pollbase.doreset = 1;
500 (void) pthread_mutex_unlock(&pollbase.mt);
508 (void) pthread_mutex_lock(&pollbase.mt);
509 pollbase.doreset = 1;
510 (void) pthread_mutex_unlock(&pollbase.mt);
527 (void) pthread_mutex_lock(&pollbase.mt);
529 if (pollbase.polling_tid == 0) {
536 (void) notify_setup(pollbase.notify_pipe);
537 if (pthread_create(&pollbase.polling_tid, attr,
542 (void) pthread_mutex_unlock(&pollbase.mt);
558 (void) pthread_mutex_lock(&pollbase.mt);
561 if (pollbase.list != NULL) {
562 for (i = 0; i < pollbase.list_len; i++) {
563 if (pollbase.list[i]) {
564 ldom_free(pollbase.list[i],
568 ldom_free(pollbase.list, pollbase.list_len *
570 pollbase.list = NULL;
571 pollbase.list_len = 0;
574 (void) pthread_mutex_unlock(&pollbase.mt);