How can I create a exclusive thread?
-
02 Nopember 2011 10:08
In Sora SDK 1.1 or 1.5, there are two exclusive threads as MAC_FM_Thread and PHY_Thread. Now some puzzled me a long period, if I want to create a exclusive thread just as this two ones, how can I do?
Actually, I'm looking forward to the help someone can give me.
Thanks
Semua Balasan
-
04 Nopember 2011 10:51
Do you mean how to use "SoraEthreadInit" and "SoraEthreadStart"?
best
yufei
-
05 Nopember 2011 11:18
No. I mean how to create a exclusive thread, for example a signal processing thread that can't be interrupted by other threads in WIN32 multithreads environment.
thanks
-
08 Nopember 2011 6:31hello, you can use INIT_SORA_THREAD() and START_SORA_THREAD() function. These are defined at __core_thread.h
-
09 Nopember 2011 16:28
If you see the source code of dot11arx.c or dot11atx.c, I think you can understand how to use it.
The below is the source code that I add in dot11arx.c to use one more thread.
BOOLEAN StartFeedbackThread() {
//Thread related codes
hFeedbackThread = SoraUThreadAlloc();
if (!hFeedbackThread)
goto error_free;
if (!SoraUThreadStart(hFeedbackThread, TxFeedback, &fContext))
goto error_free;
// printf("done? \n");
return TRUE;
error_free:
if (hFeedbackThread) {
SoraUThreadStop(hFeedbackThread);
SoraUThreadFree(hFeedbackThread);
hFeedbackThread = NULL;
}
return FALSE;
}
Here, TxFeedback is a stub function that I make to run in this thread. If the thread is created, it runs that function repeatedly.
You can see how other stub functions (DoDot11ARx, ViterbiWrapper) looks like. fContext is a struct that I make to give input to the thread
It's very easy to use. However, I sometimes wonder if it really uses a core exclusively....
-
10 Nopember 2011 6:18
Thank you very much.
but if there any one know "SoraEthreadInit" function how to work? Only a declaration in SoraSDK "_core_thread.h"
-
21 Nopember 2011 7:20
Hi, we are not going to tell the design or implementation of the exclusive thread.
Sorry for that.
-
24 Nopember 2011 9:19
As we know, exclusive thread can meet real-time requirements with minimal cost. So, if I create one new exclusive thread, for example a clock thread, then can I make this thread communicate with Sora_threads by "Event"?
However, I have failed many times when I tried to do this. This difficult has puzzled me for a long time, looking forward to your reply.
thanks