Support Board
Date/Time: Wed, 27 Nov 2024 16:49:17 +0000
Post From: C++ threads inside a ACSIL study?
[2023-02-09 04:41:44] |
ondafringe - Posts: 286 |
I know virtually nothing about the deeper level C++ stuff, but I got curious enough to try your thread test example. Coded as you have it, my study crashed, as well. Then I read something about join() and detach() and that you should explicitly do one or the other for a thread, so I added the join, like so: std::thread th1(foo, 3); th1.join(); I added my study and it acted like it was going to crash, but then my study came up and worked as expected. So I think what was happening, since my study is continuously looping, the thread is continuously being created, called, etc., and at some point, it hit some max and the thread(s) was/were terminated. Okay, so then I created a bool and wrapped the thread code inside a conditional based on that bool so the thread was only created and executed one time. I then stepped through it in debug mode and everything worked as expected. No crash. No looping issues. Then I ran it without going into debug and no issues. Again, I don't really know what I'm doing, but maybe this will help give you an idea of what you need to do to resolve your issues. Date Time Of Last Edit: 2023-02-09 05:09:10
|