Lines Matching refs:pt
40 struct lws_context_per_thread *pt = ptpr->pt;
43 lws_context_lock(pt->context, __func__);
44 lws_pt_lock(pt, __func__);
45 us = __lws_sul_service_ripe(pt->pt_sul_owner, LWS_COUNT_PT_SUL_OWNERS,
48 uv_timer_start(&pt_to_priv_uv(pt)->sultimer, lws_uv_sultimer_cb,
50 lws_pt_unlock(pt);
51 lws_context_unlock(pt->context);
62 struct lws_context_per_thread *pt = ptpr->pt;
65 lws_service_do_ripe_rxflow(pt);
67 lws_context_lock(pt->context, __func__);
68 lws_pt_lock(pt, __func__);
73 if (!lws_service_adjust_timeout(pt->context, 1, pt->tid))
75 _lws_plat_service_forced_tsi(pt->context, pt->tid);
79 us = __lws_sul_service_ripe(pt->pt_sul_owner, LWS_COUNT_PT_SUL_OWNERS,
82 uv_timer_start(&pt_to_priv_uv(pt)->sultimer, lws_uv_sultimer_cb,
86 if (lws_service_adjust_timeout(pt->context, 1, pt->tid))
89 lws_pt_unlock(pt);
90 lws_context_unlock(pt->context);
98 struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
99 struct lws_pt_eventlibs_libuv *ptpriv = pt_to_priv_uv(pt);
102 lws_context_lock(pt->context, __func__);
103 lws_pt_lock(pt, __func__);
105 if (pt->is_destroyed)
145 lws_pt_unlock(pt);
146 lws_context_unlock(pt->context);
150 if (pt->destroy_self) {
151 lws_context_destroy(pt->context);
159 lws_pt_unlock(pt);
160 lws_context_unlock(pt->context);
184 struct lws_context_per_thread *pt = (struct lws_context_per_thread *)
187 if (pt->context->eventlib_signal_cb) {
188 pt->context->eventlib_signal_cb((void *)watcher, signum);
193 lwsl_cx_err(pt->context, "internal signal handler caught signal %d",
195 lws_libuv_stop(pt->context);
199 lws_uv_finalize_pt(struct lws_context_per_thread *pt)
201 pt->event_loop_pt_unused = 1;
203 lwsl_cx_info(pt->context, "thr %d", (int)(pt - pt->context->pt));
205 lws_context_lock(pt->context, __func__);
207 if (!--pt->context->undestroyed_threads) {
208 struct lws_vhost *vh = pt->context->vhost_list;
214 lwsl_cx_debug(pt->context, "all pts down now");
223 if (!pt->count_event_loop_static_asset_handles &&
224 pt->event_loop_foreign) {
225 lwsl_cx_info(pt->context, "resuming context_destroy");
226 lws_context_unlock(pt->context);
227 lws_context_destroy(pt->context);
236 lwsl_cx_debug(pt->context, "still %d undestroyed",
237 pt->context->undestroyed_threads);
239 lws_context_unlock(pt->context);
260 struct lws_context_per_thread *pt =
262 struct lws_pt_eventlibs_libuv *ptpriv = pt_to_priv_uv(pt);
263 struct lws_context *context = pt->context;
265 int tsi = (int)(pt - &context->pt[0]);
270 pt->count_event_loop_static_asset_handles - 1,
285 // uv_walk(pt_to_priv_uv(pt)->io_loop, lws_uv_walk_cb, NULL);
296 if (!pt->event_loop_foreign)
299 lws_uv_finalize_pt(pt);
314 struct lws_context_per_thread *pt = &context->pt[tsi];
316 LWS_UV_REFCOUNT_STATIC_HANDLE_NEW(h, pt);
332 if (pt_to_priv_uv(&context->pt[tsi])->io_loop)
333 uv_stop(pt_to_priv_uv(&context->pt[tsi])->io_loop);
339 if (pt_to_priv_uv(&context->pt[tsi])->io_loop)
340 return pt_to_priv_uv(&context->pt[tsi])->io_loop;
365 pt_to_priv_uv(&context->pt[n])->w_sigint.context = context;
373 struct lws_context_per_thread *pt;
378 pt = &context->pt[n];
382 if (!pt->event_loop_foreign) {
384 while (budget-- && (m = uv_run(pt_to_priv_uv(pt)->io_loop,
394 return !context->pt[0].event_loop_foreign;
400 struct lws_context_per_thread *pt;
404 pt = &context->pt[n];
408 if (!pt->event_loop_foreign && pt_to_priv_uv(pt)->io_loop) {
411 uv_stop(pt_to_priv_uv(pt)->io_loop);
414 uv_loop_close(pt_to_priv_uv(pt)->io_loop);
416 lws_free_set_NULL(pt_to_priv_uv(pt)->io_loop);
497 struct lws_context_per_thread *pt = &wsi->a.context->pt[(int)wsi->tsi];
498 struct lws_pt_eventlibs_libuv *ptpriv = pt_to_priv_uv(pt);
515 n = uv_poll_init(pt_to_priv_uv(pt)->io_loop, w_read->pwatcher,
518 n = uv_poll_init_socket(pt_to_priv_uv(pt)->io_loop,
534 (int)(pt - &pt->context->pt[0]),
535 pt->count_event_loop_static_asset_handles,
544 struct lws_context_per_thread *pt = &wsi->a.context->pt[(int)wsi->tsi];
552 if (!pt_to_priv_uv(pt)->io_loop || !w->context) {
596 struct lws_context_per_thread *pt;
609 pt = &wsi->a.context->pt[(int)wsi->tsi];
610 ptpriv = pt_to_priv_uv(pt);
620 n = uv_poll_init_socket(pt_to_priv_uv(pt)->io_loop,
632 (int)(pt - &pt->context->pt[0]),
633 pt->count_event_loop_static_asset_handles,
646 if (pt_to_priv_uv(&context->pt[tsi])->io_loop)
647 uv_run(pt_to_priv_uv(&context->pt[tsi])->io_loop, 0);
653 struct lws_context_per_thread *pt = &context->pt[tsi];
654 struct lws_pt_eventlibs_libuv *ptpriv = pt_to_priv_uv(pt);
663 if (pt->event_loop_destroy_processing_done) {
664 if (!pt->event_loop_foreign) {
666 uv_stop(pt_to_priv_uv(pt)->io_loop);
671 pt->event_loop_destroy_processing_done = 1;
674 if (!pt->event_loop_foreign) {
676 uv_signal_stop(&pt_to_priv_uv(pt)->w_sigint.watcher);
684 uv_signal_stop(&pt_to_priv_uv(pt)->signals[m]);
685 uv_close((uv_handle_t *)&pt_to_priv_uv(pt)->signals[m],
689 lwsl_cx_debug(context, "not closing pt signals");
691 uv_timer_stop(&pt_to_priv_uv(pt)->sultimer);
692 uv_close((uv_handle_t *)&pt_to_priv_uv(pt)->sultimer, lws_uv_close_cb_sa);
694 uv_idle_stop(&pt_to_priv_uv(pt)->idle);
695 uv_close((uv_handle_t *)&pt_to_priv_uv(pt)->idle, lws_uv_close_cb_sa);
719 struct lws_context_per_thread *pt = &context->pt[tsi];
720 struct lws_pt_eventlibs_libuv *ptpriv = pt_to_priv_uv(pt);
724 ptpriv->pt = pt;
739 pt->event_loop_foreign = 0;
742 pt->event_loop_foreign = 1;
747 LWS_UV_REFCOUNT_STATIC_HANDLE_NEW(&ptpriv->idle, pt);
755 if (!pt->event_loop_foreign) {
760 &ptpriv->signals[n], pt);
761 ptpriv->signals[n].data = pt;
782 LWS_UV_REFCOUNT_STATIC_HANDLE_NEW(&ptpriv->sultimer, pt);
792 struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
793 struct lws_pt_eventlibs_libuv *ptpriv = pt_to_priv_uv(pt);
816 lws_pt_lock(pt, __func__);
819 (int)(pt - &pt->context->pt[0]),
820 pt->count_event_loop_static_asset_handles,
827 lws_pt_unlock(pt);
845 !pt->count_event_loop_static_asset_handles) {
848 * we closed everything on this pt
852 lws_uv_finalize_pt(pt);
893 struct lws_context_per_thread *pt = &cx->pt[tsi];
894 struct lws_pt_eventlibs_libuv *ptpriv = pt_to_priv_uv(pt);