1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

smp: take pt lock in poll foreign thread detection

This commit is contained in:
Andy Green 2019-02-23 15:24:57 +08:00
parent e7df97c309
commit 562dcbaf9f

View file

@ -114,6 +114,8 @@ _lws_change_pollfd(struct lws *wsi, int _and, int _or, struct lws_pollargs *pa)
ftp->fd_index = wsi->position_in_fds_table;
ftp->next = NULL;
lws_pt_lock(pt, __func__);
/* place at END of list to maintain order */
ftp1 = (struct lws_foreign_thread_pollfd **)
&vpt->foreign_pfd_list;
@ -123,6 +125,9 @@ _lws_change_pollfd(struct lws *wsi, int _and, int _or, struct lws_pollargs *pa)
*ftp1 = ftp;
vpt->foreign_spinlock = 0;
lws_memory_barrier();
lws_pt_unlock(pt);
lws_cancel_service_pt(wsi);
return 0;