Lines Matching refs:tdata

303 	GIOPThread *tdata = g_new0 (GIOPThread, 1);  in giop_thread_new()  local
305 tdata->lock = g_mutex_new (); in giop_thread_new()
306 tdata->incoming = g_cond_new (); in giop_thread_new()
307 tdata->wake_context = context; in giop_thread_new()
308 tdata->keys = NULL; in giop_thread_new()
309 tdata->async_ents = NULL; in giop_thread_new()
310 tdata->request_queue = NULL; in giop_thread_new()
313 tdata->request_handler = giop_main_thread->request_handler; in giop_thread_new()
315 return tdata; in giop_thread_new()
319 giop_thread_key_add_T (GIOPThread *tdata, gpointer key) in giop_thread_key_add_T() argument
325 tdata->keys = g_list_prepend (tdata->keys, key); in giop_thread_key_add_T()
327 g_hash_table_insert (giop_pool_hash, key, tdata); in giop_thread_key_add_T()
337 giop_thread_free (GIOPThread *tdata) in giop_thread_free() argument
341 if (tdata == giop_main_thread) in giop_thread_free()
346 for (l = tdata->keys; l != NULL; l = l->next) { in giop_thread_free()
352 g_list_free (tdata->keys); in giop_thread_free()
353 tdata->keys = NULL; in giop_thread_free()
355 g_mutex_free (tdata->lock); in giop_thread_free()
356 tdata->lock = NULL; in giop_thread_free()
357 g_cond_free (tdata->incoming); in giop_thread_free()
358 tdata->incoming = NULL; in giop_thread_free()
361 if (tdata->async_ents) in giop_thread_free()
363 if (tdata->request_queue) in giop_thread_free()
366 if (tdata->invoke_policies) { in giop_thread_free()
367 g_queue_free (tdata->invoke_policies); in giop_thread_free()
368 tdata->invoke_policies = NULL; in giop_thread_free()
371 g_free (tdata); in giop_thread_free()
379 GIOPThread *tdata; in giop_thread_self() local
384 if (!(tdata = g_private_get (giop_tdata_private))) { in giop_thread_self()
385 tdata = giop_thread_new (NULL); in giop_thread_self()
386 g_private_set (giop_tdata_private, tdata); in giop_thread_self()
389 return tdata; in giop_thread_self()
394 giop_thread_key_add (GIOPThread *tdata, gpointer key) in giop_thread_key_add() argument
397 LINK_MUTEX_LOCK (tdata->lock); in giop_thread_key_add()
399 giop_thread_key_add_T (tdata, key); in giop_thread_key_add()
401 LINK_MUTEX_UNLOCK (tdata->lock); in giop_thread_key_add()
408 GIOPThread *tdata; in giop_thread_key_release() local
412 tdata = g_hash_table_lookup (giop_pool_hash, key); in giop_thread_key_release()
413 if (tdata != NULL) { in giop_thread_key_release()
414 tdata->keys = g_list_remove (tdata->keys, key); in giop_thread_key_release()
426 GIOPThread *tdata, *new_tdata = NULL; in giop_thread_request_push_key() local
430 if (!(tdata = g_hash_table_lookup (giop_pool_hash, key))) { in giop_thread_request_push_key()
432 tdata = new_tdata; in giop_thread_request_push_key()
434 giop_thread_key_add_T (tdata, key); in giop_thread_request_push_key()
435 dprintf (GIOP, "Create new thread %p for op\n", tdata); in giop_thread_request_push_key()
437 dprintf (GIOP, "Re-use thread %p for op\n", tdata); in giop_thread_request_push_key()
439 giop_thread_request_push (tdata, poa_object, recv_buffer); in giop_thread_request_push_key()
442 g_thread_pool_push (giop_thread_pool, tdata, NULL); in giop_thread_request_push_key()
451 GIOPThread *tdata; in giop_thread_same_key() local
455 if (!(tdata = g_hash_table_lookup (giop_pool_hash, key))) in giop_thread_same_key()
458 same = tdata == giop_thread_self (); in giop_thread_same_key()
471 GIOPThread *tdata = giop_thread_self (); in giop_mainloop_handle_input() local
479 LINK_MUTEX_LOCK (tdata->lock); in giop_mainloop_handle_input()
480 while (!giop_thread_queue_empty_T (tdata)) { in giop_mainloop_handle_input()
481 LINK_MUTEX_UNLOCK (tdata->lock); in giop_mainloop_handle_input()
482 giop_thread_queue_process (tdata); in giop_mainloop_handle_input()
483 LINK_MUTEX_LOCK (tdata->lock); in giop_mainloop_handle_input()
485 LINK_MUTEX_UNLOCK (tdata->lock); in giop_mainloop_handle_input()
495 GIOPThread *tdata = data; in giop_request_handler_thread() local
497 g_private_set (giop_tdata_private, tdata); in giop_request_handler_thread()
499 dprintf (GIOP, "Thread %p woken to handle request\n", tdata); in giop_request_handler_thread()
502 giop_thread_queue_process (tdata); in giop_request_handler_thread()
505 LINK_MUTEX_LOCK (tdata->lock); in giop_request_handler_thread()
507 if ((done = giop_thread_queue_empty_T (tdata))) { in giop_request_handler_thread()
508 for (l = tdata->keys; l != NULL; l = l->next) in giop_request_handler_thread()
510 g_list_free (tdata->keys); in giop_request_handler_thread()
511 tdata->keys = NULL; in giop_request_handler_thread()
514 LINK_MUTEX_UNLOCK (tdata->lock); in giop_request_handler_thread()
519 dprintf (GIOP, "Thread %p returning to pool\n", tdata); in giop_request_handler_thread()
521 giop_thread_free (tdata); in giop_request_handler_thread()
538 GIOPThread *tdata; in giop_init() local
544 giop_main_thread = tdata = giop_thread_new ( in giop_init()
563 g_private_set (giop_tdata_private, tdata); in giop_init()
601 giop_incoming_signal_T (GIOPThread *tdata, GIOPMsgType t) in giop_incoming_signal_T() argument
603 g_cond_signal (tdata->incoming); in giop_incoming_signal_T()
605 if (t != GIOP_REPLY && tdata->wake_context) in giop_incoming_signal_T()
625 GIOPThread *tdata = ent->src_thread; in giop_invoke_async() local
627 g_mutex_lock (tdata->lock); /* ent_lock */ in giop_invoke_async()
630 tdata->async_ents = g_list_prepend (tdata->async_ents, ent); in giop_invoke_async()
631 giop_incoming_signal_T (tdata, GIOP_REQUEST); in giop_invoke_async()
633 g_mutex_unlock (tdata->lock); /* ent_unlock */ in giop_invoke_async()
696 first_valid_request (GIOPThread *tdata, gboolean *no_policy) in first_valid_request() argument
701 if (!tdata->invoke_policies || !tdata->invoke_policies->head) { in first_valid_request()
707 policy = g_queue_peek_head (tdata->invoke_policies); in first_valid_request()
709 for (l = tdata->request_queue; l; l = l->next) { in first_valid_request()
723 giop_thread_queue_empty_T (GIOPThread *tdata) in giop_thread_queue_empty_T() argument
727 if (first_valid_request (tdata, &no_policy)) in giop_thread_queue_empty_T()
731 return (!tdata->request_queue && in giop_thread_queue_empty_T()
732 !tdata->async_ents); in giop_thread_queue_empty_T()
753 giop_thread_queue_process (GIOPThread *tdata) in giop_thread_queue_process() argument
760 if (!tdata) in giop_thread_queue_process()
761 tdata = giop_thread_self (); in giop_thread_queue_process()
763 request = first_valid_request (tdata, &no_policy); in giop_thread_queue_process()
767 LINK_MUTEX_LOCK (tdata->lock); /* ent_lock */ in giop_thread_queue_process()
770 ent = giop_list_pop (&tdata->async_ents); in giop_thread_queue_process()
776 qe = giop_list_pop (&tdata->request_queue); in giop_thread_queue_process()
780 tdata->request_queue = g_list_delete_link (tdata->request_queue, request); in giop_thread_queue_process()
786 LINK_MUTEX_UNLOCK (tdata->lock); /* ent_unlock */ in giop_thread_queue_process()
792 tdata->request_handler (qe->poa_object, qe->recv_buffer, NULL); in giop_thread_queue_process()
798 giop_thread_queue_tail_wakeup (GIOPThread *tdata) in giop_thread_queue_tail_wakeup() argument
800 if (!tdata) in giop_thread_queue_tail_wakeup()
803 LINK_MUTEX_LOCK (tdata->lock); /* ent_lock */ in giop_thread_queue_tail_wakeup()
805 if ((tdata->request_queue || tdata->async_ents) && tdata->wake_context) in giop_thread_queue_tail_wakeup()
808 LINK_MUTEX_UNLOCK (tdata->lock); /* ent_unlock */ in giop_thread_queue_tail_wakeup()
812 giop_thread_request_push (GIOPThread *tdata, in giop_thread_request_push() argument
818 g_return_if_fail (tdata != NULL); in giop_thread_request_push()
829 LINK_MUTEX_LOCK (tdata->lock); in giop_thread_request_push()
831 tdata->request_queue = g_list_append (tdata->request_queue, qe); in giop_thread_request_push()
832 giop_incoming_signal_T (tdata, GIOP_REQUEST); in giop_thread_request_push()
834 LINK_MUTEX_UNLOCK (tdata->lock); in giop_thread_request_push()