This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

"semHandle" is a name or a handle?

Hi,

I am puzzled with an Ipc example notify_multicore.c (I remember there are similar things in other examples). The semphore created in .cfg is like this:

It seems to me semHandle is the name of the object. While in the .c code, see below, semHandle is still used as a handle from the function definiton of:

            Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);

 

Could you explain it to me?

 

Thanks.

 

 

...............................

*  ======== tsk0_func ========

*  Sends an event to the next processor then pends on a semaphore.

*  The semaphore is posted by the callback function.

*/

Void tsk0_func(

UArg arg0, UArg arg1)

{

 Int i = 1;

Int status;

 if (MultiProc_self() == 0) {

while (i <= NUMLOOPS) {

/* Send an event to the next processor */

            status =Notify_sendEvent(dstProc, INTERRUPT_LINE, EVENTID, i,

                    TRUE);

/* Continue until remote side is up */

if (status < 0) {continue;

            }

            System_printf("tsk1_func: Sent request #%d to %s\n", seq,

MultiProc_getName(dstProc));

/* Wait to be released by the cbFxn posting the semaphore */

            Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);

            System_printf("tsk1_func: Received request #%d from %s\n", seq,

MultiProc_getName(recvProcId));

/* increment for next iteration */

            i++;

        }

    }

   else {.................

.....................

  • In the picture of last post, what is the use of dialogue box "Handle"? It is null in the present settings. Again, semHandle is a name or a handle? Thanks. 

  • Robert,

    That field allows you to assign a name for the Semaphore to use at runtime.  If you hover the mouse pointer over the field the pop-up help says “String name usable at runtime”.

    You can try typing a name in this field and saving the configuration.  For example, if you name it “mySemHandle” and save, you can then see the following added to the end of the configuration file, if you click on the “Source” tab:

    Program.global.mySemHandle.instance.name = "mySemHandle";

    Scott