return correct propagated thread ID to receiver when propagator and receiver are local to one another

In the case of a propagated message, current->get_partner()'s result may not
refer to the same thread as from_tcb->get_{local,global}_id(). This changeset
narrows the case where local TIDs are returned to avoid this confusion.

This changeset also makes explicit (through the use of an ASSERT()) the
assumption that only global IDs are passed through propagation.
This commit is contained in:
ksandstr@iki.fi 2009-03-28 23:51:54 +02:00
parent 8220bfaf0b
commit e0f663d465
1 changed files with 7 additions and 1 deletions

View File

@ -438,6 +438,7 @@ send_path:
#endif
// The partner must be told who the IPC originated from.
ASSERT(!tag.is_propagated() || sender_id.is_global());
to_tcb->set_partner(sender_id);
if (EXPECT_FALSE( !transfer_message(current, to_tcb, tag) ))
@ -728,8 +729,13 @@ send_path:
}
current->set_state(thread_state_t::running);
#if defined(HANDLE_LOCAL_IDS)
if (current->get_space () == from_tcb->get_space ())
// only global TIDs are passed through propagation, hence the test
// against from_tcb->get_global_id().
if (current->get_space () == from_tcb->get_space ()
&& current->get_partner() == from_tcb->get_global_id())
{
return_ipc (from_tcb->get_local_id ());
}
#endif
return_ipc(current->get_partner());
}