<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ks_c_5601-1987">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:;
        panose-1:2 11 6 0 0 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:" ";
        panose-1:2 11 5 3 2 0 0 2 0 4;}
@font-face
        {font-family:"\@ ";}
@font-face
        {font-family:"\@";
        panose-1:2 11 6 0 0 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        text-autospace:none;
        word-break:break-hangul;
        font-size:10.0pt;
        font-family:" ";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:40.0pt;
        margin-bottom:.0001pt;
        mso-para-margin-top:0cm;
        mso-para-margin-right:0cm;
        mso-para-margin-bottom:0cm;
        mso-para-margin-left:4.0gd;
        mso-para-margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        text-autospace:none;
        word-break:break-hangul;
        font-size:10.0pt;
        font-family:" ";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:" ";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:" ";}
/* Page Definitions */
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:3.0cm 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:71701846;
        mso-list-template-ids:1341823648;}
@list l1
        {mso-list-id:754781843;
        mso-list-template-ids:-1695746820;}
@list l2
        {mso-list-id:1934850896;
        mso-list-template-ids:73179158;}
@list l0:level1 lfo2
        {mso-level-start-at:2;}
@list l1:level1 lfo3
        {mso-level-start-at:3;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="KO" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:10.0pt;margin-bottom:.0001pt;mso-margin-top-alt:0cm;mso-para-margin-right:0cm;mso-para-margin-bottom:0cm;mso-para-margin-left:1.0gd;mso-para-margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" "">Hello,<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:10.0pt;margin-bottom:.0001pt;mso-margin-top-alt:0cm;mso-para-margin-right:0cm;mso-para-margin-bottom:0cm;mso-para-margin-left:1.0gd;mso-para-margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" ""> <o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:10.0pt;margin-bottom:.0001pt;mso-margin-top-alt:0cm;mso-para-margin-right:0cm;mso-para-margin-bottom:0cm;mso-para-margin-left:1.0gd;mso-para-margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" "">Below is what I have written before.<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:10.0pt;margin-bottom:.0001pt;mso-margin-top-alt:0cm;mso-para-margin-right:0cm;mso-para-margin-bottom:0cm;mso-para-margin-left:1.0gd;mso-para-margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"><a href="https://libwebsockets.org/pipermail/libwebsockets/2019-November/008154.html"><span style="font-size:12.0pt;font-family:" "">https://libwebsockets.org/pipermail/libwebsockets/2019-November/008154.html</span></a><o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:10.0pt;margin-bottom:.0001pt;mso-margin-top-alt:0cm;mso-para-margin-right:0cm;mso-para-margin-bottom:0cm;mso-para-margin-left:1.0gd;mso-para-margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" ""> <o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:10.0pt;margin-bottom:.0001pt;mso-margin-top-alt:0cm;mso-para-margin-right:0cm;mso-para-margin-bottom:0cm;mso-para-margin-left:1.0gd;mso-para-margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" "">Thank you for the kind reply before. I have not learned how to reply in the mailing list yet.
<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:10.0pt;margin-bottom:.0001pt;mso-margin-top-alt:0cm;mso-para-margin-right:0cm;mso-para-margin-bottom:0cm;mso-para-margin-left:1.0gd;mso-para-margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" ""><o:p> </o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:10.0pt;margin-bottom:.0001pt;mso-margin-top-alt:0cm;mso-para-margin-right:0cm;mso-para-margin-bottom:0cm;mso-para-margin-left:1.0gd;mso-para-margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" "">I have several additional questions.<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:10.0pt;margin-bottom:.0001pt;mso-margin-top-alt:0cm;mso-para-margin-right:0cm;mso-para-margin-bottom:0cm;mso-para-margin-left:1.0gd;mso-para-margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" "">I am currently porting libwebsockets into the my existing server.<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:10.0pt;margin-bottom:.0001pt;mso-margin-top-alt:0cm;mso-para-margin-right:0cm;mso-para-margin-bottom:0cm;mso-para-margin-left:1.0gd;mso-para-margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" ""><o:p> </o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:10.0pt;margin-bottom:.0001pt;mso-margin-top-alt:0cm;mso-para-margin-right:0cm;mso-para-margin-bottom:0cm;mso-para-margin-left:1.0gd;mso-para-margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"><a href="https://libwebsockets.org/pipermail/libwebsockets/2014-September/001357.html"><span style="font-size:12.0pt;font-family:" "">https://libwebsockets.org/pipermail/libwebsockets/2014-September/001357.html
</span></a><o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:10.0pt;margin-bottom:.0001pt;mso-margin-top-alt:0cm;mso-para-margin-right:0cm;mso-para-margin-bottom:0cm;mso-para-margin-left:1.0gd;mso-para-margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" "">This link says that wsi should be handled only inside callback.<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:27.0pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" ""> <o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="margin-left:27.0pt;text-align:left;text-indent:-18.0pt;mso-list:l2 level1 lfo1;text-autospace:ideograph-numeric ideograph-other;vertical-align:middle;word-break:keep-all">
<![if !supportLists]><span lang="EN-US"><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman"">    
</span></span></span><![endif]><span lang="EN-US">Can I deliver/pass </span><span lang="EN-US">wsi</span><span lang="EN-US"> pointer received from my http callback to other threads and call lws_write(wsi,
</span><span lang="EN-US">) in those other threads like below? Is wsi pointer thread safe?<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:27.0pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" "">I observe a crash sometimes inside lws_write which is hard to find the reason.<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:81.0pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" "">lws_write(wsi_pointer,<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:108.0pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" "">(unsigned char *)(buffer+LWS_SEND_BUFFER_PRE_PADDING),<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:108.0pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" "">Buffer Length,<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:108.0pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" "">LWS_WRITE_BINARY);<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:27.0pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" ""> <o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="margin-left:27.0pt;text-align:left;text-indent:-18.0pt;mso-list:l0 level1 lfo2;text-autospace:ideograph-numeric ideograph-other;vertical-align:middle;word-break:keep-all">
<![if !supportLists]><span lang="EN-US"><span style="mso-list:Ignore">2.<span style="font:7.0pt "Times New Roman"">    
</span></span></span><![endif]><span lang="EN-US">Let's assume that using wsi pointer is allowed to access from other thread.<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:27.0pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" "">Then, I'd like to close client connection from different threads in my streaming server instead of closing it from the inside of my http callback.<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:27.0pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" "">How can I close a specific client from other threads which are different from my http callback.<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:27.0pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" ""><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="margin-left:27.0pt;text-align:left;text-indent:-18.0pt;mso-list:l1 level1 lfo3;text-autospace:ideograph-numeric ideograph-other;vertical-align:middle;word-break:keep-all">
<![if !supportLists]><span lang="EN-US"><span style="mso-list:Ignore">3.<span style="font:7.0pt "Times New Roman"">    
</span></span></span><![endif]><span lang="EN-US">Let's again assume that using wsi pointer is allowed to access from other thread.<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:27.0pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" "">Do I have to monitor writable status of the wsi from http callback and let other threads know that and call lws_write from other threads?<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:27.0pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" ""> <o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:27.0pt;margin-bottom:.0001pt">
<span lang="EN-US" style="font-size:10.0pt;font-family:" "">Is there any way which I can use like (xxx.</span><span lang="EN-US" style="font-size:11.0pt;font-family:" "">revents &POLLOUT) from different threads through wsi pointer?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoListParagraph" style="margin-left:36.0pt;mso-para-margin-left:0gd;text-indent:-18.0pt;mso-list:l1 level1 lfo3">
<![if !supportLists]><span lang="EN-US"><span style="mso-list:Ignore">4.<span style="font:7.0pt "Times New Roman"">    
</span></span></span><![endif]><span lang="EN-US">If inside lws_xxx function crashes, how do you usually debug?<o:p></o:p></span></p>
<p class="MsoListParagraph" style="margin-left:36.0pt;mso-para-margin-left:0gd"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-indent:9.75pt"><span lang="EN-US">(P.S: I dont know how to add additional question in the added answer. Please teach me how to do that as well
</span><span lang="EN-US" style="font-family:Wingdings">J</span><span lang="EN-US">)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:9.75pt"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-indent:9.75pt"><span lang="EN-US">Best Regards,<o:p></o:p></span></p>
</div>
</body>
</html>