<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: Explicit multi-threading in Matlab part 3	</title>
	<atom:link href="https://undocumentedmatlab.com/articles/explicit-multi-threading-in-matlab-part3/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com/articles/explicit-multi-threading-in-matlab-part3?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=explicit-multi-threading-in-matlab-part3</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Fri, 06 Jun 2025 12:35:37 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>
	<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/explicit-multi-threading-in-matlab-part3#comment-526793</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Fri, 06 Jun 2025 12:35:37 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=4686#comment-526793</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/explicit-multi-threading-in-matlab-part3#comment-526791&quot;&gt;Eric&lt;/a&gt;.

@Eric - I suspect the most likely cause is that you&#039;re using R2024b in which the memory model is different from the one used in 2014 when I wrote the original article (over 10 years and ~25 Matlab releases ago!). On R2018a or newer you should avoid using the &lt;code&gt;mxGetPr()&lt;/code&gt; method, or at the very least mex-compile using the &lt;code&gt;-R2017b&lt;/code&gt; flag. See &lt;a href=&quot;https://www.mathworks.com/help/matlab/apiref/mxgetpr.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow ugc&quot;&gt;https://www.mathworks.com/help/matlab/apiref/mxgetpr.html&lt;/a&gt; and &lt;a href=&quot;https://undocumentedmatlab.com/articles/multi-threaded-mex&quot; target=&quot;_blank&quot; rel=&quot;ugc&quot;&gt;https://undocumentedmatlab.com/articles/multi-threaded-mex&lt;/a&gt; for details. Using a bad reference pointer returned by &lt;code&gt;mxGetPr()&lt;/code&gt; may well crash the program.

Possible other causes:
 1) You&#039;re using a pre-compiled version of the program that was compiled on another computer that has a non-100%-compatible compiler, or perhaps a different version of Matlab or &lt;i&gt;libmex.dll&lt;/i&gt; in the compiled vs. run-time computers.
 2) You did not trap your code in a try-catch block. The code calls &lt;code&gt;mexErrMsgIdAndTxt()&lt;/code&gt; and this raises an exception that crashes your program since the exception is apparently uncaught. Take a look at the &lt;i&gt;myPosixThread.c&lt;/i&gt; source code.
 3) Perhaps in R2024b the interface of the &lt;code&gt;mexErrMsgIdAndTxt()&lt;/code&gt; MEX function has changed since the time that I wrote the article in 2014. Check your local &lt;i&gt;mex.h&lt;/i&gt; file.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/explicit-multi-threading-in-matlab-part3#comment-526791">Eric</a>.</p>
<p>@Eric &#8211; I suspect the most likely cause is that you&#8217;re using R2024b in which the memory model is different from the one used in 2014 when I wrote the original article (over 10 years and ~25 Matlab releases ago!). On R2018a or newer you should avoid using the <code>mxGetPr()</code> method, or at the very least mex-compile using the <code>-R2017b</code> flag. See <a href="https://www.mathworks.com/help/matlab/apiref/mxgetpr.html" target="_blank" rel="nofollow ugc">https://www.mathworks.com/help/matlab/apiref/mxgetpr.html</a> and <a href="https://undocumentedmatlab.com/articles/multi-threaded-mex" target="_blank" rel="ugc">https://undocumentedmatlab.com/articles/multi-threaded-mex</a> for details. Using a bad reference pointer returned by <code>mxGetPr()</code> may well crash the program.</p>
<p>Possible other causes:<br />
 1) You&#8217;re using a pre-compiled version of the program that was compiled on another computer that has a non-100%-compatible compiler, or perhaps a different version of Matlab or <i>libmex.dll</i> in the compiled vs. run-time computers.<br />
 2) You did not trap your code in a try-catch block. The code calls <code>mexErrMsgIdAndTxt()</code> and this raises an exception that crashes your program since the exception is apparently uncaught. Take a look at the <i>myPosixThread.c</i> source code.<br />
 3) Perhaps in R2024b the interface of the <code>mexErrMsgIdAndTxt()</code> MEX function has changed since the time that I wrote the article in 2014. Check your local <i>mex.h</i> file.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Eric		</title>
		<link>https://undocumentedmatlab.com/articles/explicit-multi-threading-in-matlab-part3#comment-526791</link>

		<dc:creator><![CDATA[Eric]]></dc:creator>
		<pubDate>Thu, 05 Jun 2025 18:59:11 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=4686#comment-526791</guid>

					<description><![CDATA[I am having trouble running the myPosixThread mex-function. MATLAB crashes when I run it the first time or may be at the 2nd and third time. For successful execution, file is successfully created. Can you advise what could have gone wrong? I do see another pthreadVC2.dll in the MinGW compiler, I tried deleting it but still face the same issue. 

Unhandled C++ exception detected at 2025-06-05 11:32:12 -0700
&lt;code&gt;
% Configuration:
%   Crash Decoding           : Disabled - No sandbox or build area path
%   Crash Mode               : continue (default)
%   Default Encoding         : UTF-8
%   Deployed                 : false
%   Graphics Driver          : Uninitialized hardware 
%   Graphics card 1          : NVIDIA ( 0x10de ) NVIDIA RTX 2000 Ada Generation Version 32.0.15.5612 (2024-6-25)
%   Graphics card 2          : Microsoft ( 0x0 ) Microsoft Remote Display Adapter Version 10.0.19041.5794 (2006-6-21)
%   Java Version             : Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
%   MATLAB Architecture      : win64
%   MATLAB Entitlement ID    : 98xxxxx
%   MATLAB Root              : C:\Program Files\MATLAB\R2024b
%   MATLAB Version           : 24.2.0.2773142 (R2024b) Update 2
%   OpenGL                   : hardware
%   Operating System         : Microsoft Windows 10 Enterprise
%   Process ID               : 14612
%   Processor ID             : x86 Family 25 Model 24 Stepping 1, AuthenticAMD
%   Session Key              : 1b61df14-e0d5-49bd-9d0c-9157xxxxxx
%   Window System            : Version 10.0 (Build 19045)
% 
% Fault Count: 1
% 
% Abnormal termination:
% Unhandled C++ exception
% 
% Current Thread: &#039;&#039; id 29128
% 
% Register State (from fault):
%   RAX = 0000000000000000  RBX = 00007ff936a6b468
%   RCX = 0000000000000000  RDX = 0000000000000000
%   RSP = 00000070073fd7f0  RBP = 00000070073ffad9
%   RSI = 00000070073fd998  RDI = 0000000019930520
% 
%    R8 = 0000000000000000   R9 = 0000000000000000
%   R10 = 0000000000000000  R11 = 0000000000000000
%   R12 = 0000000000000000  R13 = 0000000000000000
%   R14 = 0000000000000000  R15 = 0000000000000000
% 
%   RIP = 00007ff9d743af29  EFL = 00000206
% 
%    CS = 0033   FS = 0053   GS = 002b
% 
% Stack Trace (from fault):
% [  0] 0x00007ff9d743af29                 C:\WINDOWS\System32\KERNELBASE.dll+00241449 RaiseException+00000105
% [  1] 0x00007ff9ce896720 C:\Program Files\MATLAB\R2024b\bin\win64\VCRUNTIME140.dll+00026400 CxxThrowException+00000144
% [  2] 0x00007ff9369f529c C:\Program Files\MATLAB\R2024b\bin\win64\libmex.dll+00545436 mexErrMsgIdAndTxt_800+00000220
% [  3] 0x00007ff8f8c0112c C:\Users\Eric\Documents\MATLAB\PODs\myPosixThread.mexw64+00004396 mexFunction+00000300
% [  4] 0x00007ff8f8be65bc C:\Program Files\MATLAB\R2024b\bin\win64\pthreadVC2.dll+00026044 pthread_key_delete+00020828
% [  5] 0x00007ff9d7751bb2                   C:\WINDOWS\System32\ucrtbase.dll+00138162 configthreadlocale+00000146
% [  6] 0x00007ff9d98a7374                   C:\WINDOWS\System32\KERNEL32.DLL+00095092 BaseThreadInitThunk+00000020
% [  7] 0x00007ff9d9c3cc91                      C:\WINDOWS\SYSTEM32\ntdll.dll+00314513 RtlUserThreadStart+00000033
&lt;/code&gt;]]></description>
			<content:encoded><![CDATA[<p>I am having trouble running the myPosixThread mex-function. MATLAB crashes when I run it the first time or may be at the 2nd and third time. For successful execution, file is successfully created. Can you advise what could have gone wrong? I do see another pthreadVC2.dll in the MinGW compiler, I tried deleting it but still face the same issue. </p>
<p>Unhandled C++ exception detected at 2025-06-05 11:32:12 -0700<br />
<code><br />
% Configuration:<br />
%   Crash Decoding           : Disabled - No sandbox or build area path<br />
%   Crash Mode               : continue (default)<br />
%   Default Encoding         : UTF-8<br />
%   Deployed                 : false<br />
%   Graphics Driver          : Uninitialized hardware<br />
%   Graphics card 1          : NVIDIA ( 0x10de ) NVIDIA RTX 2000 Ada Generation Version 32.0.15.5612 (2024-6-25)<br />
%   Graphics card 2          : Microsoft ( 0x0 ) Microsoft Remote Display Adapter Version 10.0.19041.5794 (2006-6-21)<br />
%   Java Version             : Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode<br />
%   MATLAB Architecture      : win64<br />
%   MATLAB Entitlement ID    : 98xxxxx<br />
%   MATLAB Root              : C:\Program Files\MATLAB\R2024b<br />
%   MATLAB Version           : 24.2.0.2773142 (R2024b) Update 2<br />
%   OpenGL                   : hardware<br />
%   Operating System         : Microsoft Windows 10 Enterprise<br />
%   Process ID               : 14612<br />
%   Processor ID             : x86 Family 25 Model 24 Stepping 1, AuthenticAMD<br />
%   Session Key              : 1b61df14-e0d5-49bd-9d0c-9157xxxxxx<br />
%   Window System            : Version 10.0 (Build 19045)<br />
%<br />
% Fault Count: 1<br />
%<br />
% Abnormal termination:<br />
% Unhandled C++ exception<br />
%<br />
% Current Thread: '' id 29128<br />
%<br />
% Register State (from fault):<br />
%   RAX = 0000000000000000  RBX = 00007ff936a6b468<br />
%   RCX = 0000000000000000  RDX = 0000000000000000<br />
%   RSP = 00000070073fd7f0  RBP = 00000070073ffad9<br />
%   RSI = 00000070073fd998  RDI = 0000000019930520<br />
%<br />
%    R8 = 0000000000000000   R9 = 0000000000000000<br />
%   R10 = 0000000000000000  R11 = 0000000000000000<br />
%   R12 = 0000000000000000  R13 = 0000000000000000<br />
%   R14 = 0000000000000000  R15 = 0000000000000000<br />
%<br />
%   RIP = 00007ff9d743af29  EFL = 00000206<br />
%<br />
%    CS = 0033   FS = 0053   GS = 002b<br />
%<br />
% Stack Trace (from fault):<br />
% [  0] 0x00007ff9d743af29                 C:\WINDOWS\System32\KERNELBASE.dll+00241449 RaiseException+00000105<br />
% [  1] 0x00007ff9ce896720 C:\Program Files\MATLAB\R2024b\bin\win64\VCRUNTIME140.dll+00026400 CxxThrowException+00000144<br />
% [  2] 0x00007ff9369f529c C:\Program Files\MATLAB\R2024b\bin\win64\libmex.dll+00545436 mexErrMsgIdAndTxt_800+00000220<br />
% [  3] 0x00007ff8f8c0112c C:\Users\Eric\Documents\MATLAB\PODs\myPosixThread.mexw64+00004396 mexFunction+00000300<br />
% [  4] 0x00007ff8f8be65bc C:\Program Files\MATLAB\R2024b\bin\win64\pthreadVC2.dll+00026044 pthread_key_delete+00020828<br />
% [  5] 0x00007ff9d7751bb2                   C:\WINDOWS\System32\ucrtbase.dll+00138162 configthreadlocale+00000146<br />
% [  6] 0x00007ff9d98a7374                   C:\WINDOWS\System32\KERNEL32.DLL+00095092 BaseThreadInitThunk+00000020<br />
% [  7] 0x00007ff9d9c3cc91                      C:\WINDOWS\SYSTEM32\ntdll.dll+00314513 RtlUserThreadStart+00000033<br />
</code></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/explicit-multi-threading-in-matlab-part3#comment-354695</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Fri, 07 Aug 2015 15:34:31 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=4686#comment-354695</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/explicit-multi-threading-in-matlab-part3#comment-354688&quot;&gt;shahbaz&lt;/a&gt;.

@Shahbaz - I believe that your Matlab installation is corrupt. Try to uninstall Matlab and then re-install it from scratch.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/explicit-multi-threading-in-matlab-part3#comment-354688">shahbaz</a>.</p>
<p>@Shahbaz &#8211; I believe that your Matlab installation is corrupt. Try to uninstall Matlab and then re-install it from scratch.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: shahbaz		</title>
		<link>https://undocumentedmatlab.com/articles/explicit-multi-threading-in-matlab-part3#comment-354688</link>

		<dc:creator><![CDATA[shahbaz]]></dc:creator>
		<pubDate>Fri, 07 Aug 2015 13:40:51 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=4686#comment-354688</guid>

					<description><![CDATA[Matlab r2014a is not open this show&quot;boost_date_time-vc110-mt1_49.dll missing your computer how to solve this problem help me sir]]></description>
			<content:encoded><![CDATA[<p>Matlab r2014a is not open this show&#8221;boost_date_time-vc110-mt1_49.dll missing your computer how to solve this problem help me sir</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/explicit-multi-threading-in-matlab-part3#comment-328073</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Fri, 18 Jul 2014 08:31:52 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=4686#comment-328073</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/explicit-multi-threading-in-matlab-part3#comment-327736&quot;&gt;Oliver Woodford&lt;/a&gt;.

@Oliver - Matlab does not include the Boost header files, but it is easy to view the documentation and &lt;a href=&quot;http://boost.org/users/download&quot; rel=&quot;nofollow&quot;&gt;download the relevant files&lt;/a&gt; from the Boost website.  Be careful to download the version that fits your Matlab&#039;s pre-installed version, otherwise segmentation violations could occur. For example, on R2014a Windows, the Boost threading library file is called boost_thread-vc100-mt-1_49.dll, indicating version 1.49 dated Feb 2012, two years behind the latest Boost release (&lt;a href=&quot;http://boost.org/users/history&quot; rel=&quot;nofollow&quot;&gt;change-log&lt;/a&gt;). It is not advisable in this case to install a newer Boost and link our MEX file with it, since clashes might occur with the standard Matlab libraries that use the older (pre-installed) Boost libs and are used internally by MEX. 

For a working example, Kevin Stone’s &lt;a href=&quot;http://bengal.missouri.edu/~kes25c/SharedMemory-Windows.zip&quot; rel=&quot;nofollow&quot;&gt;SharedMemory utilities&lt;/a&gt;, use the &lt;a href=&quot;http://boost.org/doc/libs/1_55_0/doc/html/interprocess/managed_memory_segments.html&quot; rel=&quot;nofollow&quot;&gt;Boost IPC&lt;/a&gt; library.

&lt;a href=&quot;http://absurdlycertain.blogspot.com/2011/09/preamble-what-follows-is-guide.html&quot; rel=&quot;nofollow&quot;&gt;AbsurdlyCertain&lt;/a&gt; provides a detailed account of integrating Boost threads into MEX. Also see related &lt;a href=&quot;http://absurdlycertain.blogspot.coml/2011/09/simpler-concurrent-matlab-programming.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://mathworks.com/matlabcentral/answers/12648&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.

Boost certainly deserves a dedicated article. Care to take up my leads above and create a guest article here?]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/explicit-multi-threading-in-matlab-part3#comment-327736">Oliver Woodford</a>.</p>
<p>@Oliver &#8211; Matlab does not include the Boost header files, but it is easy to view the documentation and <a href="http://boost.org/users/download" rel="nofollow">download the relevant files</a> from the Boost website.  Be careful to download the version that fits your Matlab&#8217;s pre-installed version, otherwise segmentation violations could occur. For example, on R2014a Windows, the Boost threading library file is called boost_thread-vc100-mt-1_49.dll, indicating version 1.49 dated Feb 2012, two years behind the latest Boost release (<a href="http://boost.org/users/history" rel="nofollow">change-log</a>). It is not advisable in this case to install a newer Boost and link our MEX file with it, since clashes might occur with the standard Matlab libraries that use the older (pre-installed) Boost libs and are used internally by MEX. </p>
<p>For a working example, Kevin Stone’s <a href="http://bengal.missouri.edu/~kes25c/SharedMemory-Windows.zip" rel="nofollow">SharedMemory utilities</a>, use the <a href="http://boost.org/doc/libs/1_55_0/doc/html/interprocess/managed_memory_segments.html" rel="nofollow">Boost IPC</a> library.</p>
<p><a href="http://absurdlycertain.blogspot.com/2011/09/preamble-what-follows-is-guide.html" rel="nofollow">AbsurdlyCertain</a> provides a detailed account of integrating Boost threads into MEX. Also see related <a href="http://absurdlycertain.blogspot.coml/2011/09/simpler-concurrent-matlab-programming.html" rel="nofollow">here</a> and <a href="http://mathworks.com/matlabcentral/answers/12648" rel="nofollow">here</a>.</p>
<p>Boost certainly deserves a dedicated article. Care to take up my leads above and create a guest article here?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Oliver Woodford		</title>
		<link>https://undocumentedmatlab.com/articles/explicit-multi-threading-in-matlab-part3#comment-327736</link>

		<dc:creator><![CDATA[Oliver Woodford]]></dc:creator>
		<pubDate>Fri, 11 Jul 2014 15:33:54 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=4686#comment-327736</guid>

					<description><![CDATA[Hi Yair,
You mentioned that the Boost library is included in every relatively-modern Matlab release. How would one go about linking mex files to this library?
Many thanks,
Oliver]]></description>
			<content:encoded><![CDATA[<p>Hi Yair,<br />
You mentioned that the Boost library is included in every relatively-modern Matlab release. How would one go about linking mex files to this library?<br />
Many thanks,<br />
Oliver</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
