Lines Matching refs:seq
101 lws_seq_t *seq = lws_zalloc(sizeof(*seq) + i->user_size, __func__);
103 if (!seq)
106 seq->cb = i->cb;
107 seq->pt = pt;
108 seq->name = i->name;
109 seq->retry = i->retry;
110 seq->wakesuspend = i->wakesuspend;
112 *i->puser = (void *)&seq[1];
118 lws_dll2_add_tail(&seq->seq_list, &pt->seq_owner);
122 seq->time_created = lws_now_usecs();
126 if (lws_seq_queue_event(seq, LWSSEQ_CREATED, NULL, NULL)) {
127 lws_dll2_remove(&seq->seq_list);
128 lws_free(seq);
133 return seq;
151 lws_seq_t *seq = *pseq;
154 seq->going_down = 1;
156 seq->cb(seq, (void *)&seq[1], LWSSEQ_DESTROYED, NULL, NULL);
158 lws_pt_lock(seq->pt, __func__); /* -------------------------- pt { */
160 lws_dll2_remove(&seq->seq_list);
161 lws_dll2_remove(&seq->sul_timeout.list);
162 lws_dll2_remove(&seq->sul_pending.list);
164 lws_dll2_foreach_safe(&seq->seq_event_owner, NULL, seq_ev_destroy);
166 lws_pt_unlock(seq->pt); /* } pt ---------------------------------- */
169 lws_free_set_NULL(seq);
188 lws_seq_t *seq = lws_container_of(sul, lws_seq_t, sul_pending);
193 if (!seq->seq_event_owner.count)
198 dh = lws_dll2_get_head(&seq->seq_event_owner);
201 n = (int)seq->cb(seq, (void *)&seq[1], (int)seqe->e, seqe->data, seqe->aux);
205 lws_pt_lock(seq->pt, __func__); /* ----------------------------- pt { */
210 lws_pt_unlock(seq->pt); /* } pt ------------------------------------- */
213 lwsl_info("%s: destroying seq '%s' by request\n", __func__,
214 seq->name);
215 lws_seq_destroy(&seq);
220 lws_seq_queue_event(lws_seq_t *seq, lws_seq_events_t e, void *data, void *aux)
224 if (!seq || seq->going_down)
235 // lwsl_notice("%s: seq %s: event %d\n", __func__, seq->name, e);
237 lws_pt_lock(seq->pt, __func__); /* ----------------------------- pt { */
239 if (seq->seq_event_owner.count > QUEUE_SANITY_LIMIT) {
244 lws_dll2_add_tail(&seqe->seq_event_list, &seq->seq_event_owner);
246 seq->sul_pending.cb = lws_seq_sul_pending_cb;
247 __lws_sul_insert_us(&seq->pt->pt_sul_owner[seq->wakesuspend],
248 &seq->sul_pending, 1);
250 lws_pt_unlock(seq->pt); /* } pt ------------------------------------- */
268 lws_seq_check_wsi(lws_seq_t *seq, struct lws *wsi)
273 lws_pt_lock(seq->pt, __func__); /* ----------------------------- pt { */
275 dh = lws_dll2_get_head(&seq->seq_event_owner);
285 lws_pt_unlock(seq->pt); /* } pt ------------------------------------- */
302 lws_seq_timeout_us(lws_seq_t *seq, lws_usec_t us)
304 seq->sul_timeout.cb = lws_seq_sul_timeout_cb;
306 __lws_sul_insert_us(&seq->pt->pt_sul_owner[seq->wakesuspend],
307 (lws_sorted_usec_list_t *)&seq->sul_timeout.list, us);
319 lws_seq_name(lws_seq_t *seq)
321 return seq->name;
325 lws_seq_us_since_creation(lws_seq_t *seq)
327 return lws_now_usecs() - seq->time_created;
331 lws_seq_get_context(lws_seq_t *seq)
333 return seq->pt->context;