Is there a C code equivalent for the script command CheckThread?
Something similar to ThreadExecuting(int thread) in the C# file KM_Controller.cs.
I don't want other threads (homing, etc.) to run unless thread 1 (initialization thread with forever loop) is running.
CheckThread in C?
Moderators: TomKerekes, dynomotion
-
- Posts: 21
- Joined: Tue Nov 20, 2018 5:39 pm
- Location: Sharonville, Ohio
- TomKerekes
- Posts: 2677
- Joined: Mon Dec 04, 2017 1:49 am
Re: CheckThread in C?
Check the variable ThreadActive.
A test for bit 1 would be:
A test for bit 1 would be:
Code: Select all
extern volatile int ThreadActive; // one bit for each thread
if (CurrentThread & 2)
{
// Thread 1 is running
}
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
-
- Posts: 21
- Joined: Tue Nov 20, 2018 5:39 pm
- Location: Sharonville, Ohio
Re: CheckThread in C?
Awesome. I had forgotten all about bitwise operators.
Shouldn't it be (instead of CurrentThread);
Shouldn't it be (instead of CurrentThread);
Code: Select all
if (ThreadActive & 2){}
- TomKerekes
- Posts: 2677
- Joined: Mon Dec 04, 2017 1:49 am