Can a task call function implemented in another task ?

Hello, we are using Keil's RTX Real-Time Operating System.

In this OS or in a typical OS, can a task call function defined in another task ?
LVL 1
naseeamAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

evilrixSenior Software Engineer (Avast)Commented:
By "task" do you mean different process?
0
naseeamAuthor Commented:
Yes
0
evilrixSenior Software Engineer (Avast)Commented:
Ok, then I guess what you're really talking about is interprocess communication. In other words, one process instructing another to perform some action, right?

The answer will really depend on the Operating System's system API. For example, Unix generally implements RCP using Unix pipes. Windows, on the oher hand, will use other methods (although it, too, has a concept of pipes).

I'm not sure if this helps but if it doesn't maybe you could add some context to your question; mostly, what is it you are trying to achieve?
0
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

sarabandeCommented:
as far as i could see from

http://www.keil.com/support/man/docs/rlarm/rlarm_ar_artxarm.htm

tasks would run an infinite loop and wait for events. so if you want to call a function of task2 from task1 you would trigger an event which was detected by task2 and task2 would process the requested function. there are a lot of samples in the above site which should help you.

Sara
0
naseeamAuthor Commented:
>>  function of task2

What is functions of task2.  Do you mean there is a funtion defined inside task.  I don't think that's possible.
0
naseeamAuthor Commented:
>>  what is it you are trying to achieve

From task1, I was calling a function.
From task1, I need to call this function through task 2.
0
sarabandeCommented:
the code is from example 1 of the link I posted above:

__task void task1 (void)  {
  os_tsk_create (task2, 0);

  for (;;)  {
    .... code of task 1 placed here ....
  }
}

__task void task2 (void)  {

  for (;;)  {
    os_evt_wait_or (0x0004, 0xffff);
    os_dly_wait (2);
    os_evt_set (0x0004, id1);
  }
}

Open in new window


from the code you see that both tasks were running an infinite loop and wait for events. if an event was recognized, the task would go on and can execute a code depending on the event and other data that was passed with the event or was passed by other p2p means, for example shared memory. the site has more complex samples.

Sara
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
naseeamAuthor Commented:
>>  Sara

I think you are explaning how to setup simple application using Keil real time operating system.
I think you are explaning how task communicate with each other using events.

My question is "Can a task call function implemented in another task."  I realize this question doesn't make sense because functions aren't implemented inside tasks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.