34 static pthread_mutex_t
mutex = PTHREAD_MUTEX_INITIALIZER;
45 pthread_mutex_lock (&
mutex);
49 (GDestroyNotify) g_queue_free);
51 GQueue * list = g_hash_table_lookup (
hooks, name);
54 g_hash_table_insert (
hooks,
str_get (name), list = g_queue_new ());
62 g_queue_push_tail (list, item);
64 pthread_mutex_unlock (&
mutex);
69 pthread_mutex_lock (&
mutex);
74 GQueue * list = g_hash_table_lookup (
hooks, name);
79 for (GList * node = list->head; node;)
82 GList * next = node->next;
84 if (item->
func == func && (! user || item->
user == user))
90 g_queue_delete_link (list, node);
99 g_hash_table_remove (
hooks, name);
102 pthread_mutex_unlock (&
mutex);
107 pthread_mutex_lock (&
mutex);
112 GQueue * list = g_hash_table_lookup (
hooks, name);
117 for (GList * node = list->head; node;)
124 pthread_mutex_unlock (&
mutex);
128 pthread_mutex_lock (&
mutex);
132 GList * next = node->next;
136 g_queue_delete_link (list, node);
144 g_hash_table_remove (
hooks, name);
147 pthread_mutex_unlock (&
mutex);