<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">Hello,</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">After spending 10 seconds googling
      "setlocale crash" I can inform you that:</div>
    <div class="moz-cite-prefix">
      <ul>
        <li>On Windows setlocale is not thread safe</li>
        <ul>
          <li><a class="moz-txt-link-freetext" href="https://social.msdn.microsoft.com/Forums/windowsserver/en-US/b46aa226-d337-43c3-8d15-135f6fca9b53/setlocale-behavior-in-multithreaded-applications?forum=vcgeneral">https://social.msdn.microsoft.com/Forums/windowsserver/en-US/b46aa226-d337-43c3-8d15-135f6fca9b53/setlocale-behavior-in-multithreaded-applications?forum=vcgeneral</a></li>
        </ul>
        <li>It hasn't been thread safe since Visual C++ 2012.</li>
        <ul>
          <li><a class="moz-txt-link-freetext" href="https://www.tolon.co.uk/2014/10/beware-setlocale/">https://www.tolon.co.uk/2014/10/beware-setlocale/</a></li>
        </ul>
      </ul>
      <p>Regards,</p>
      <p>Jonathan<br>
      </p>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">On 26/10/2021 16:22, Richard Lince
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:2196ac15-6f5c-bc31-7f89-7bca7fa8e6d0@bluebox.video">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <font size="-1"><font face="Helvetica, Arial, sans-serif">Hi Ross,<br>
          <br>
          Yes, very familiar with the FAQs, we certainly fall into this
          category during the single process test:<br>
          <br>
          "</font></font><font size="-1"><font face="Helvetica, Arial,
          sans-serif">Another possible way to access the code from
          multiple threads is to have each thread use its own
          "UsageEnvironment" and "TaskScheduler" objects, and thus its
          own event loop. The objects created by each thread (i.e.,
          using its own "UsageEnvironment") must not interact (except
          via global variables). Such a configuration is not
          recommended, however; instead, it is safer to structure such
          an application as multiple <em>processes</em>, not multiple
          threads. "<br>
          <br>
          Not using any static variables, all code remains class based
          our side. Each RTSPClient has its own thread for the event
          loop and we invoke on another dedicated thread ourside for
          invoking response handlers. Simply put, if we define </font></font><font
        size="-1"><font face="Helvetica, Arial, sans-serif"><b>LOCALE_NOT_USED
          </b>we can stream 96+ instances (each with its own
          environment, task scheduler & set of event triggers)
          within a single process.<br>
          <br>
          It was strange to see the 'setlocale' being the issue and
          wondered if you had any idea or seen this before?<br>
          Are we perhaps calling 'setlocale' to often and abusing it
          somehow, it's called quite often..?<br>
          <br>
          Thanks!<br>
          <br>
          <b><br>
          </b></font></font>
      <div class="moz-cite-prefix">On 26/10/2021 14:21, Ross Finlayson
        wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:277900F4-E5DE-43A5-ADFE-4F36927969BA@live555.com">
        <pre class="moz-quote-pre" wrap="">I didn’t really follow this.  However, I was disturbed by the following:

</pre>
        <blockquote type="cite">
          <pre class="moz-quote-pre" wrap="">By default the NEWLOCALE_NOT_USED is defined and works great when we run up many streaming windows all in separate process's.
If we use a single process (less memory consumed by NVIDIA graphics) we see an access violation
</pre>
        </blockquote>
        <pre class="moz-quote-pre" wrap="">I hope you are not running more than one thread in "a single process” - because this is not allowed.  LIVE555 code (within a single process) is meant to run as a single thread, using a (single-threaded) event loop for concurrency.  See <a class="moz-txt-link-freetext" href="http://live555.com/liveMedia/faq.html#threads" moz-do-not-send="true">http://live555.com/liveMedia/faq.html#threads</a>


Ross Finlayson
Live Networks, Inc.
<a class="moz-txt-link-freetext" href="http://www.live555.com/" moz-do-not-send="true">http://www.live555.com/</a>


_______________________________________________
live-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:live-devel@lists.live555.com" moz-do-not-send="true">live-devel@lists.live555.com</a>
<a class="moz-txt-link-freetext" href="http://lists.live555.com/mailman/listinfo/live-devel" moz-do-not-send="true">http://lists.live555.com/mailman/listinfo/live-devel</a>
</pre>
      </blockquote>
      <br>
      <div class="moz-signature"><font size="2" face="calibri"
          color="black"> Best Regards,<br>
          Richard Lince,<br>
          Founder & Managing Director<br>
          <br>
          <a href="https://www.bluebox.video" moz-do-not-send="true">bluebox.video</a>
          <br>
          +44(0)7841665146<br>
        </font><br>
        <img alt="logo"
          src="cid:part6.38F73C6F.2680B812@denbridgemarine.com" class=""></div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
live-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:live-devel@lists.live555.com">live-devel@lists.live555.com</a>
<a class="moz-txt-link-freetext" href="http://lists.live555.com/mailman/listinfo/live-devel">http://lists.live555.com/mailman/listinfo/live-devel</a>
</pre>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>