locked
How can I create a exclusive thread? RRS feed

  • Question

  • 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

    Wednesday, November 2, 2011 10:08 AM

All replies

  • Do you mean how to use "SoraEthreadInit" and "SoraEthreadStart"?

     

    best

    yufei

    Friday, November 4, 2011 10:51 AM
  • 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

    Saturday, November 5, 2011 11:18 AM
  • hello, you can use INIT_SORA_THREAD() and START_SORA_THREAD() function. These are defined at __core_thread.h
    Tuesday, November 8, 2011 6:31 AM
  • 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....

     

    Wednesday, November 9, 2011 4:28 PM
  • Thank you very much.

    but if there any one know "SoraEthreadInit" function how to work?  Only a declaration in SoraSDK "_core_thread.h"

    Thursday, November 10, 2011 6:18 AM
  • Hi, we are not going to tell the design or implementation of the exclusive thread.

    Sorry for that.

     

    Monday, November 21, 2011 7:20 AM
  • 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

    Thursday, November 24, 2011 9:19 AM