Call process from process in Contiki

866 views Asked by At

In my code, I need to declare two process. In the first process, I want to call the second one like this:

PROCESS_THREAD(Initialization_process, ev, data)
{    
  PROCESS_BEGIN();

   PROCESS_THREAD(example_broadcast_process, ev, data);

  PROCESS_END();
}

But I got this error:

error: invalid storage class for function ‘process_thread_example_broadcast_process’

How can we call a process from another process please?

1

There are 1 answers

0
kfx On BEST ANSWER

If you just want to start another process asynchronously, define this process (let's say example_broadcast_process) as usual, in the file scope, and then call process_start() from the other process:

process_start(&example_broadcast_process, NULL);

If you desire synchronous operation, you can call PT_SPAWN to start a new protothread.