This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RTX51-Tiny: os_wait2(..) return question

If I call os_wait2(..) as listed in the example below, and if subsequently another task signals MyTask() AND it times out, what will the return value be? The manual states the return value will be a manifest constant identifying the event that restarted the task, but its not clear whether this is only one of the constants or can be a combination thereof.

void MyTask( void ) _task_ 0
{
    ret_val = os_wait2( K_SIG | K_TMO, 25 );

    // what will ret_val be if the task both
    // timed out AND was signaled ???
}

  • It is not possible for both events to occur at the same time.

  • So lets say the task times out, but before RTX returns to it, another task signals it as well. Will it miss the signal?

  • I suppose its not possible for both of them to occur at precisely the same time, but it is certainly possible for both of them to occur before RTX returns control back to the task. Thus the original question: which event, if any, takes priority with respect to the return value from the wait function?

  • See at
    http://www.keil.com/support/man/docs/tr51/tr51_os_wait.htm

    The os_wait return value may be or-ed with all of posible return values at once. You must bit-check all possible events from the return value.

  • That states that the "event_sel" input parameter may be ORed, but it says nothing about the reply being an ORed combination of more than one value.

  • For a really detailed question like this, you might want to email tech support. Officially, this forum is for users and not Keil's means of tech support.

    (Unless someone in the general user base happens to already have asked that question, it's not likely that they'll know answers about implementation details that aren't in the manual or easily discoverable by experiment.)

  • Well, as it turns out, I did resort to some experimentation. As in the original example above, I performed the os_wait2(..) specifying K_SIG | K_TMO for the event types, then I let another task a) delay long enough for the first task's timeout to expire, then b) I signaled it. ( I also swapped the order of a and b around as well).

    In both instances, upon return to the original task, its return type indicated SIG_EVENT. Thus, I conclude K_SIG takes priority.

    Now, is this "proof" that K_SIG takes priority? Only so far as the accuracy of the experiment. I would have a much greater feeling of confidence in this answer if examination of Tiny's task switch code verified the conclusion as well. That area of the source code, however, isn't too straight forward.

    Perhaps if one of Kiel's tech support personnel read this, they can confirm or deny what I found.

    Thanks to everyone for you help and suggestions.

    R. Wey