Lines Matching refs:vhd
60 * Access is serialized by vhd->lock_ring.
83 struct per_vhost_data__minimal *vhd =
88 for (n = 0; n < (int)LWS_ARRAY_SIZE(vhd->pthread_spam); n++)
89 if (pthread_equal(pthread_self(), vhd->pthread_spam[n]))
94 if (!vhd->pss_list)
97 pthread_mutex_lock(&vhd->lock_ring); /* --------- ring lock { */
100 n = (int)lws_ring_get_count_free_elements(vhd->ring);
112 "%s: tid: %d, msg: %d", vhd->config,
115 n = (int)lws_ring_insert(vhd->ring, &amsg, 1);
124 lws_cancel_service(vhd->context);
127 pthread_mutex_unlock(&vhd->lock_ring); /* } ring lock ------- */
132 } while (!vhd->finished);
149 struct per_vhost_data__minimal *vhd =
161 vhd = lws_protocol_vh_priv_zalloc(lws_get_vhost(wsi),
164 if (!vhd)
167 pthread_mutex_init(&vhd->lock_ring, NULL);
177 vhd->config = pvo->value;
179 vhd->context = lws_get_context(wsi);
180 vhd->protocol = lws_get_protocol(wsi);
181 vhd->vhost = lws_get_vhost(wsi);
183 vhd->ring = lws_ring_create(sizeof(struct msg), 8,
185 if (!vhd->ring) {
192 for (n = 0; n < (int)LWS_ARRAY_SIZE(vhd->pthread_spam); n++)
193 if (pthread_create(&vhd->pthread_spam[n], NULL,
194 thread_spam, vhd)) {
203 vhd->finished = 1;
204 for (n = 0; n < (int)LWS_ARRAY_SIZE(vhd->pthread_spam); n++)
205 if (vhd->pthread_spam[n])
206 pthread_join(vhd->pthread_spam[n], &retval);
208 if (vhd->ring)
209 lws_ring_destroy(vhd->ring);
211 pthread_mutex_destroy(&vhd->lock_ring);
215 /* add ourselves to the list of live pss held in the vhd */
216 lws_ll_fwd_insert(pss, pss_list, vhd->pss_list);
217 pss->tail = lws_ring_get_oldest_tail(vhd->ring);
224 pss, vhd->pss_list);
228 pthread_mutex_lock(&vhd->lock_ring); /* --------- ring lock { */
230 pmsg = lws_ring_get_element(vhd->ring, &pss->tail);
232 pthread_mutex_unlock(&vhd->lock_ring); /* } ring lock ------- */
240 pthread_mutex_unlock(&vhd->lock_ring); /* } ring lock ------- */
246 vhd->ring, /* lws_ring object */
250 vhd->pss_list, /* head of list of objects with tails */
256 if (lws_ring_get_element(vhd->ring, &pss->tail))
260 pthread_mutex_unlock(&vhd->lock_ring); /* } ring lock ------- */
267 if (!vhd)
278 ppss, vhd->pss_list) {