Lines Matching refs:pt
65 * These helpers attach only to the main_context that belongs to the pt's glib
68 * instead of specifically the loop bound to the pt.
74 lws_glib_set_idle(struct lws_context_per_thread *pt)
76 if (lws_gs_valid(pt_to_priv_glib(pt)->idle))
79 pt_to_priv_glib(pt)->idle.gs = g_idle_source_new();
80 if (!pt_to_priv_glib(pt)->idle.gs)
83 g_source_set_callback(pt_to_priv_glib(pt)->idle.gs,
84 lws_glib_idle_timer_cb, pt, NULL);
85 pt_to_priv_glib(pt)->idle.tag = g_source_attach(
86 pt_to_priv_glib(pt)->idle.gs, pt_to_g_main_context(pt));
92 lws_glib_set_timeout(struct lws_context_per_thread *pt, unsigned int ms)
94 lws_gs_destroy(pt_to_priv_glib(pt)->hrtimer);
96 pt_to_priv_glib(pt)->hrtimer.gs = g_timeout_source_new(ms);
97 if (!pt_to_priv_glib(pt)->hrtimer.gs)
100 g_source_set_callback(pt_to_priv_glib(pt)->hrtimer.gs,
101 lws_glib_hrtimer_cb, pt, NULL);
102 pt_to_priv_glib(pt)->hrtimer.tag = g_source_attach(
103 pt_to_priv_glib(pt)->hrtimer.gs,
104 pt_to_g_main_context(pt));
114 struct lws_context_per_thread *pt;
138 pt = &sub->wsi->a.context->pt[(int)sub->wsi->tsi];
139 if (pt->is_destroyed)
144 if (!lws_gs_valid(pt_to_priv_glib(pt)->idle))
145 lws_glib_set_idle(pt);
147 if (pt->destroy_self)
148 lws_context_destroy(pt->context);
169 struct lws_context_per_thread *pt = (struct lws_context_per_thread *)p;
173 lws_pt_lock(pt, __func__);
175 lws_gs_destroy(pt_to_priv_glib(pt)->hrtimer);
177 us = __lws_sul_service_ripe(pt->pt_sul_owner, LWS_COUNT_PT_SUL_OWNERS,
184 lws_glib_set_timeout(pt, ms);
187 lws_pt_unlock(pt);
189 lws_glib_set_idle(pt);
197 struct lws_context_per_thread *pt = (struct lws_context_per_thread *)p;
199 if (pt->is_destroyed)
202 lws_service_do_ripe_rxflow(pt);
203 lws_glib_hrtimer_cb(pt);
208 if (!lws_service_adjust_timeout(pt->context, 1, pt->tid)) {
210 _lws_plat_service_forced_tsi(pt->context, pt->tid);
212 if (!lws_service_adjust_timeout(pt->context, 1, pt->tid))
216 if (pt->destroy_self)
217 lws_context_destroy(pt->context);
226 lws_gs_destroy(pt_to_priv_glib(pt)->idle);
234 struct lws_context_per_thread *pt = ctx;
236 pt->inside_service = 1;
238 if (pt->context->eventlib_signal_cb) {
239 pt->context->eventlib_signal_cb(NULL, 0);
243 if (!pt->event_loop_foreign)
244 g_main_loop_quit(pt_to_loop(pt));
256 // pt_to_priv_glib(&context->pt[n])->w_sigint.context = context;
264 struct lws_context_per_thread *pt = &wsi->a.context->pt[(int)wsi->tsi];
291 g_source_attach(wsi_to_gsource(wsi), pt_to_g_main_context(pt));
309 struct lws_context_per_thread *pt = &context->pt[tsi];
310 struct lws_pt_eventlibs_glib *ptpr = pt_to_priv_glib(pt);
316 context->pt[tsi].event_loop_foreign = 1;
328 lws_glib_set_idle(pt);
332 if (pt->event_loop_foreign)
336 G_SOURCE_FUNC(lws_glib_sigint_cb), pt);
348 struct lws_context_per_thread *pt = &wsi->a.context->pt[(int)wsi->tsi];
352 if (!pt_to_loop(pt) || wsi->a.context->being_destroyed ||
353 pt->is_destroyed)
390 struct lws_context_per_thread *pt = &context->pt[tsi];
392 if (pt_to_loop(pt))
393 g_main_loop_run(pt_to_loop(pt));
399 struct lws_context_per_thread *pt;
404 pt = &wsi->a.context->pt[(int)wsi->tsi];
405 if (pt->is_destroyed)
435 struct lws_context_per_thread *pt = &context->pt[tsi];
436 struct lws_pt_eventlibs_glib *ptpr = pt_to_priv_glib(pt);
438 if (!pt_to_loop(pt))
446 if (!pt->event_loop_foreign) {
447 g_main_loop_quit(pt_to_loop(pt));
449 g_main_loop_unref(pt_to_loop(pt));
452 pt_to_loop(pt) = NULL;
458 struct lws_context_per_thread *pt = &context->pt[0];
462 if (!pt->event_loop_foreign)
463 g_main_loop_quit(pt_to_loop(pt));
464 pt++;