30 #ifndef SC_SIMCONTEXT_INT_H
31 #define SC_SIMCONTEXT_INT_H
46 # define DEBUG_NAME ""
47 # define DEBUG_MSG(NAME,P,MSG) \
49 if ( P && ( (strlen(NAME)==0) || !strcmp(NAME,P->name())) ) \
50 std::cout << "**** " << sc_time_stamp() << " (" \
51 << sc_get_current_process_name() << "): " << MSG \
52 << " - " << P->name() << std::endl; \
55 # define DEBUG_MSG(NAME,P,MSG)
70 result = active_p->
name();
72 result =
"** NONE **";
88 m_current_writer = m_write_check ? process_h : (
sc_object*)0;
135 sc_curr_proc_info caller_info;
142 if ( thread_h->next_runnable() != NULL )
143 remove_runnable_thread( thread_h );
156 if ( active_p == NULL )
158 std::vector<sc_thread_handle>* invokers_p;
164 caller_info = m_curr_proc_info;
165 if ( invokers_p->size() != 0 )
167 invoke_thread_p = invokers_p->back();
169 "queueing invocation thread to execute next" );
170 execute_thread_next(invoke_thread_p);
172 DEBUG_MSG( DEBUG_NAME, thread_h,
"preempting method with thread" );
174 m_cor_pkg->
yield( thread_h->m_cor_p );
175 m_curr_proc_info = caller_info;
176 DEBUG_MSG(DEBUG_NAME, thread_h,
"back from preempting method w/thread");
177 method_p->check_for_throws();
188 else if ( active_p != thread_h )
191 "preempting active thread with thread" );
192 execute_thread_next( active_p );
193 execute_thread_next( thread_h );
194 active_p->suspend_me();
205 DEBUG_MSG(DEBUG_NAME,thread_h,
"self preemption of active thread");
206 execute_thread_next( thread_h );
207 active_p->suspend_me();
243 sc_simcontext::pop_runnable_method()
246 if( method_h == 0 ) {
256 sc_simcontext::pop_runnable_thread()
259 if( thread_h == 0 ) {
282 std::vector<sc_thread_handle>&
285 return m_active_invokers;
const char * name() const
void push_front_thread(sc_thread_handle)
static sc_process_b * m_last_created_process_p
friend class sc_process_b
void push_front_method(sc_method_handle)
sc_process_b * sc_get_current_process_b()
sc_curr_proc_handle get_curr_proc_info()
sc_simcontext * sc_get_curr_simcontext()
class sc_thread_process * sc_thread_handle
void push_back_method(sc_method_handle)
void execute_method_next(sc_method_handle)
#define DEBUG_MSG(NAME, P, MSG)
void set_curr_proc(sc_process_b *)
const char * sc_get_current_process_name()
void execute_thread_next(sc_thread_handle)
void remove_method(sc_method_handle)
void push_back_thread(sc_thread_handle)
void remove_thread(sc_thread_handle)
sc_process_b * process_handle
sc_method_handle pop_method()
class sc_method_process * sc_method_handle
virtual void yield(sc_cor *next_cor)=0
sc_curr_proc_kind proc_kind() const
void sc_defunct_process_function(sc_module *)
sc_thread_handle pop_thread()
std::vector< sc_thread_handle > & get_active_invokers()