Lines Matching defs:tcdp

125 sigev_add_work(thread_communication_data_t *tcdp,
128 tpool_t *tpool = tcdp->tcd_poolp;
145 sigev_destroy_pool(thread_communication_data_t *tcdp)
147 if (tcdp->tcd_poolp != NULL)
148 tpool_abandon(tcdp->tcd_poolp);
149 tcdp->tcd_poolp = NULL;
151 if (tcdp->tcd_subsystem == MQ) {
155 sig_mutex_lock(&tcdp->tcd_lock);
156 tcdp->tcd_server_id = 0;
157 if (tcdp->tcd_msg_closing) {
158 (void) cond_broadcast(&tcdp->tcd_cv);
159 sig_mutex_unlock(&tcdp->tcd_lock);
162 sig_mutex_unlock(&tcdp->tcd_lock);
168 free_sigev_handler(tcdp);
189 thread_communication_data_t *tcdp = (thread_communication_data_t *)arg;
193 pthread_cleanup_push(sigev_destroy_pool, tcdp);
196 if (port_get(tcdp->tcd_port, &port_event, NULL) != 0) {
198 tcdp->tcd_port, errno, strerror(errno));
211 tcdp->tcd_port, port_event.portev_source);
216 tcdp->tcd_overruns = port_event.portev_events - 1;
217 if (sigev_add_work(tcdp,
218 tcdp->tcd_notif.sigev_notify_function,
219 tcdp->tcd_notif.sigev_value) != 0)
222 tpool_wait(tcdp->tcd_poolp);
232 thread_communication_data_t *tcdp = (thread_communication_data_t *)arg;
239 pthread_cleanup_push(sigev_destroy_pool, tcdp);
242 sig_mutex_lock(&tcdp->tcd_lock);
243 pthread_cleanup_push(sig_mutex_unlock, &tcdp->tcd_lock);
244 while ((ntype = tcdp->tcd_msg_enabled) == 0)
245 (void) sig_cond_wait(&tcdp->tcd_cv, &tcdp->tcd_lock);
248 while (sem_wait(tcdp->tcd_msg_avail) == -1)
251 sig_mutex_lock(&tcdp->tcd_lock);
252 tcdp->tcd_msg_enabled = 0;
253 sig_mutex_unlock(&tcdp->tcd_lock);
257 function = tcdp->tcd_notif.sigev_notify_function;
258 argument.sival_ptr = tcdp->tcd_msg_userval;
259 ret = sigev_add_work(tcdp, function, argument);
261 ret = _port_dispatch(tcdp->tcd_port, 0, PORT_SOURCE_MQ,
262 0, (uintptr_t)tcdp->tcd_msg_object,
263 tcdp->tcd_msg_userval);
266 sig_mutex_unlock(&tcdp->tcd_lock);
275 thread_communication_data_t *tcdp = (thread_communication_data_t *)arg;
285 pthread_cleanup_push(sigev_destroy_pool, tcdp);
288 if (port_get(tcdp->tcd_port, &port_event, NULL) != 0) {
291 tcdp->tcd_port, error, strerror(error));
304 tcdp->tcd_port, port_event.portev_source);
348 else if (pthread_attr_equal(attrp, tcdp->tcd_attrp))
349 error = sigev_add_work(tcdp, function, argument);
383 if (_port_dispatch(tcdp->tcd_port, 0,
406 thread_communication_data_t *tcdp;
408 if ((tcdp = lmalloc(sizeof (*tcdp))) != NULL) {
409 tcdp->tcd_subsystem = caller;
410 tcdp->tcd_port = -1;
411 (void) mutex_init(&tcdp->tcd_lock, USYNC_THREAD, NULL);
412 (void) cond_init(&tcdp->tcd_cv, USYNC_THREAD, NULL);
414 return (tcdp);
421 free_sigev_handler(thread_communication_data_t *tcdp)
423 if (tcdp->tcd_attrp) {
424 (void) pthread_attr_destroy(tcdp->tcd_attrp);
425 tcdp->tcd_attrp = NULL;
427 (void) memset(&tcdp->tcd_notif, 0, sizeof (tcdp->tcd_notif));
429 switch (tcdp->tcd_subsystem) {
432 if (tcdp->tcd_port >= 0)
433 (void) close(tcdp->tcd_port);
436 tcdp->tcd_msg_avail = NULL;
437 tcdp->tcd_msg_object = NULL;
438 tcdp->tcd_msg_userval = NULL;
439 tcdp->tcd_msg_enabled = 0;
443 lfree(tcdp, sizeof (*tcdp));
452 thread_communication_data_t *tcdp;
460 if ((tcdp = alloc_sigev_handler(caller)) == NULL) {
466 tcdp->tcd_attrp = NULL; /* default attributes */
474 tcdp->tcd_attrp = &tcdp->tcd_user_attr;
475 error = pthread_attr_clone(tcdp->tcd_attrp,
478 tcdp->tcd_attrp = NULL;
479 free_sigev_handler(tcdp);
484 tcdp->tcd_notif = *sigevp;
485 tcdp->tcd_notif.sigev_notify_attributes = tcdp->tcd_attrp;
488 if ((tcdp->tcd_port = port_create()) < 0 ||
489 fcntl(tcdp->tcd_port, FD_CLOEXEC) == -1) {
490 free_sigev_handler(tcdp);
495 return (tcdp);
502 launch_spawner(thread_communication_data_t *tcdp)
510 switch (tcdp->tcd_subsystem) {
526 tcdp->tcd_poolp = tpool_create(1, maxworkers, 20,
527 tcdp->tcd_notif.sigev_notify_attributes);
528 if (tcdp->tcd_poolp == NULL)
533 ret = thr_create(NULL, 0, spawner, tcdp,
534 THR_DETACHED | THR_DAEMON, &tcdp->tcd_server_id);
537 tpool_destroy(tcdp->tcd_poolp);
538 tcdp->tcd_poolp = NULL;
553 thread_communication_data_t *tcdp;
555 if ((uint_t)timer < timer_max && (tcdp = timer_tcd[timer]) != NULL) {
556 sig_mutex_lock(&tcdp->tcd_lock);
557 if (tcdp->tcd_port >= 0) {
558 if ((rc = port_alert(tcdp->tcd_port,
564 sig_mutex_unlock(&tcdp->tcd_lock);
572 thread_communication_data_t *tcdp;
574 if ((uint_t)timer < timer_max && (tcdp = timer_tcd[timer]) != NULL)
575 return (tcdp->tcd_overruns);
580 del_sigev_mq_cleanup(thread_communication_data_t *tcdp)
582 sig_mutex_unlock(&tcdp->tcd_lock);
583 free_sigev_handler(tcdp);
592 del_sigev_mq(thread_communication_data_t *tcdp)
597 sig_mutex_lock(&tcdp->tcd_lock);
599 server_id = tcdp->tcd_server_id;
600 tcdp->tcd_msg_closing = 1;
602 sig_mutex_unlock(&tcdp->tcd_lock);
611 pthread_cleanup_push(del_sigev_mq_cleanup, tcdp);
612 while (tcdp->tcd_server_id == server_id)
613 (void) sig_cond_wait(&tcdp->tcd_cv, &tcdp->tcd_lock);
631 thread_communication_data_t *tcdp;
646 if ((tcdp = sigev_aio_tcd) != NULL)
647 port = tcdp->tcd_port;
652 tcdp = setup_sigev_handler(sigevp, AIO);
653 if (tcdp == NULL) {
656 } else if (launch_spawner(tcdp) != 0) {
657 free_sigev_handler(tcdp);
658 tcdp = NULL;
662 port = tcdp->tcd_port;
666 sigev_aio_tcd = tcdp;
699 thread_communication_data_t *tcdp;
701 if ((tcdp = sigev_aio_tcd) != NULL) {
703 tcd_teardown(tcdp);
709 * Clean up the tcdp data structure and close the port.
712 tcd_teardown(thread_communication_data_t *tcdp)
714 if (tcdp->tcd_poolp != NULL)
715 tpool_abandon(tcdp->tcd_poolp);
716 tcdp->tcd_poolp = NULL;
717 tcdp->tcd_server_id = 0;
718 free_sigev_handler(tcdp);