28 #ifndef SC_COR_PTHREAD_H
29 #define SC_COR_PTHREAD_H
32 #if defined(SC_USE_PTHREADS)
40 class sc_cor_pkg_pthread;
55 class sc_cor_pthread :
public sc_cor
63 virtual ~sc_cor_pthread();
66 static void* invoke_module_method(
void* context_p );
71 virtual void increment_counter();
76 virtual void decrement_counter();
81 virtual unsigned int get_counter();
85 static sc_cor_pthread* m_active_cor_p;
92 pthread_mutex_t m_mutex;
94 sc_cor_pkg_pthread* m_pkg_p;
95 pthread_cond_t m_pt_condition;
102 unsigned int m_counter;
107 sc_cor_pthread(
const sc_cor_pthread& );
108 sc_cor_pthread& operator = (
const sc_cor_pthread& );
118 class sc_cor_pkg_pthread
124 sc_cor_pkg_pthread( sc_simcontext* simc );
127 virtual ~sc_cor_pkg_pthread();
130 virtual sc_cor* create( std::size_t stack_size,
sc_cor_fn* fn,
void* arg );
133 virtual void yield( sc_cor* next_cor );
138 virtual void wait( sc_cor* cur_cor );
143 virtual void go( sc_cor* next_cor );
146 virtual void abort( sc_cor* next_cor );
149 virtual void join( sc_cor* join_cor );
152 virtual sc_cor* get_main();
157 virtual void acquire_sched_mutex();
162 virtual void release_sched_mutex();
167 virtual void set_thread_specific(
void* process_b );
172 virtual void* get_thread_specific();
177 virtual bool is_locked();
182 virtual bool is_unlocked();
187 virtual bool is_lock_owner();
192 virtual bool is_not_owner();
198 virtual bool is_locked_and_owner();
202 static int instance_count;
207 sc_cor_pkg_pthread();
208 sc_cor_pkg_pthread(
const sc_cor_pkg_pthread& );
209 sc_cor_pkg_pthread& operator = (
const sc_cor_pkg_pthread& );
237 #endif // defined(SC_USE_PTHREADS)
void wait(int, sc_simcontext *)
void( sc_cor_fn)(void *)
Function type for creating coroutines.
sc_cor_pkg_qt sc_cor_pkg_t