My purpose is to use '
sc_pending_activity_at_current_time()' to detect if there are other processes scheduled at the current simulation time. So I coded like the following:
Code:
...
void thread_kid1()
{
string nm = " >thread_kid1<";
cout << nm<<": Pending act at now: "<< sc_pending_activity_at_current_time()<<"\n";
}
void thread_kid2()
{
string nm = " >thread_kid2<";
cout << nm<<": Pending act at now: "<< sc_pending_activity_at_current_time()<<"\n";
event_mom.notify(100, SC_NS);
}
void thread_mom()
{
string nm = " >thread_mom<";
cout << nm<<": Pending act at now: "<< sc_pending_activity_at_current_time()<<"\n";
event_kid.notify(10,SC_NS);
}
...
...
SC_THREAD(thread_kid1)
dont_initialize();
sensitive << event_kid;
SC_THREAD(thread_kid2)
dont_initialize();
sensitive << event_kid;
SC_THREAD(thread_mom)
dont_initialize();
sensitive << event_mom;
event_mom.notify(100,SC_NS);
1. My main question is: why i always got a '0' from 'sc_pending_activity_at_current_time()'?
The definition of this API is at 'sc_simcontext.cpp', which is very short:
Code:
// Return indication if there are more processes to execute in this delta phase
bool
sc_pending_activity_at_current_time()
{
sc_simcontext* c_p = sc_get_curr_simcontext();
return (c_p->m_delta_events.size() != 0) ||
!c_p->m_runnable->is_empty() ||
c_p->m_prim_channel_registry->pending_updates();
}
I think the 'c_p->m_runnable->is_empty()' should return a '0' for the first executed kid thread and hence '1' should be returned. But as said, i always got a 0, so what is wrong?
2. My minor question is 'event_mom.notify(100, SC_NS);' does not evoke the 'thread_mom' , strange enough, why?
So my poets, which part of the story does not have a good rhythm, systemc or my code?

Thanks for any help!