Boost logo

Boost Users :

Subject: Re: [Boost-users] [Thread] code segfaults/hangs when being called from matlab, not when run standalone
From: Robert Valkenburg (rj.valkenburg_at_[hidden])
Date: 2012-01-31 01:48:20


Hi,

This could be a completely off track but we have had some issues with
mex and boost because Matlab keeps a stash of boost libs - take a look
in the matlab directories and you should find a number of boost libs
and they are likely to be quite old. The mex compiler may put then on
the lib path before anything you add.

This thread describes problem also
   http://www.mathworks.cn/matlabcentral/newsreader/view_thread/306429

On Tue, Jan 31, 2012 at 5:33 PM, Dougal Sutherland <dougal_at_[hidden]> wrote:
>
> On Mon, Jan 30, 2012 at 1:21 PM, Dougal Sutherland <dougal_at_[hidden]> wrote:
>>
>> I have some code using boost::thread that works fine when it's called
>> directly from a main() function, but (almost) always segfaults and/or hangs
>> forever when called from a Matlab mex interface. I don't know whether that's
>> due to the Matlab interface breaking something about boost::thread or if the
>> different environment is revealing a flaw with my code.
>
>
> As it turns out, I get the same results with a trivial program:
>
> void doNothing() { return; }
>
> void doWork() {
>     boost::thread t1(doNothing);
>     t1.join();
> }
>
> This runs fine standalone -- though DRD in Valgrind 3.7 gives me tons of
> errors when I run this with Boost 1.48 on my Mac -- but segfaults
> intermittently when run from matlab.
>
> Is this definitely a matlab problem? I'm not sure how it really could be,
> but it also seems incredibly unlikely that there would be a race condition
> or something in such a basic component of Boost.Thread.
>
> Any thoughts?
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net