| 359 | } |
| 360 | |
| 361 | static void sender_timeout(void *parameter) |
| 362 | { |
| 363 | rt_sched_lock_level_t slvl; |
| 364 | struct rt_thread *thread = (struct rt_thread *)parameter; |
| 365 | rt_channel_t ch; |
| 366 | |
| 367 | rt_sched_lock(&slvl); |
| 368 | |
| 369 | ch = (rt_channel_t)(thread->wakeup_handle.user_data); |
| 370 | if (ch->stat == RT_IPC_STAT_ACTIVE && ch->reply == thread) |
| 371 | { |
| 372 | ch->stat = RT_IPC_STAT_IDLE; |
| 373 | ch->reply = RT_NULL; |
| 374 | } |
| 375 | else |
| 376 | { |
| 377 | rt_ipc_msg_t msg; |
| 378 | rt_list_t *l; |
| 379 | |
| 380 | l = ch->wait_msg.next; |
| 381 | while (l != &ch->wait_msg) |
| 382 | { |
| 383 | msg = rt_list_entry(l, struct rt_ipc_msg, mlist); |
| 384 | if (msg->need_reply && msg->msg.sender == thread) |
| 385 | { |
| 386 | rt_list_remove(&msg->mlist); /* remove the msg from the channel */ |
| 387 | _ipc_msg_free(msg); |
| 388 | break; |
| 389 | } |
| 390 | l = l->next; |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | thread->wakeup_handle.func = RT_NULL; |
| 395 | thread->error = RT_ETIMEOUT; |
| 396 | |
| 397 | /* insert to schedule ready list */ |
| 398 | rt_sched_insert_thread(thread); |
| 399 | /* do schedule */ |
| 400 | rt_sched_unlock_n_resched(slvl); |
| 401 | } |
| 402 | |
| 403 | /** |
| 404 | * Get file vnode from fd. |
nothing calls this directly
no test coverage detected