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 ??? }
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
View all questions in Keil forum