#include <sc_semaphore.h>
Public メソッド | |
sc_semaphore (int init_value_) | |
sc_semaphore (const char *name_, int init_value_) | |
virtual int | wait () |
virtual int | trywait () |
virtual int | post () |
virtual int | get_value () const |
virtual const char * | kind () const |
Protected メソッド | |
bool | in_use () const |
void | report_error (const char *id, const char *add_msg=0) const |
Protected 変数 | |
sc_event | m_free |
int | m_value |
Private メソッド | |
sc_semaphore (const sc_semaphore &) | |
sc_semaphore & | operator= (const sc_semaphore &) |
sc_semaphore.h の 65 行で定義されています。
sc_core::sc_semaphore::sc_semaphore | ( | int | init_value_ | ) | [explicit] |
sc_semaphore.cpp の 74 行で定義されています。
00075 : sc_prim_channel( sc_gen_unique_name( "semaphore" ) ), 00076 m_value( init_value_ ) 00077 { 00078 if( m_value < 0 ) { 00079 report_error( SC_ID_INVALID_SEMAPHORE_VALUE_ ); 00080 } 00081 }
sc_core::sc_semaphore::sc_semaphore | ( | const char * | name_, | |
int | init_value_ | |||
) |
sc_semaphore.cpp の 83 行で定義されています。
00084 : sc_prim_channel( name_ ), m_value( init_value_ ) 00085 { 00086 if( m_value < 0 ) { 00087 report_error( SC_ID_INVALID_SEMAPHORE_VALUE_ ); 00088 } 00089 }
sc_core::sc_semaphore::sc_semaphore | ( | const sc_semaphore & | ) | [private] |
int sc_core::sc_semaphore::wait | ( | ) | [virtual] |
sc_core::sc_prim_channelを再定義しています。
sc_semaphore.cpp の 97 行で定義されています。
00098 { 00099 while( in_use() ) { 00100 sc_prim_channel::wait( m_free ); 00101 } 00102 -- m_value; 00103 return 0; 00104 }
int sc_core::sc_semaphore::trywait | ( | ) | [virtual] |
int sc_core::sc_semaphore::post | ( | ) | [virtual] |
virtual int sc_core::sc_semaphore::get_value | ( | ) | const [inline, virtual] |
virtual const char* sc_core::sc_semaphore::kind | ( | ) | const [inline, virtual] |
bool sc_core::sc_semaphore::in_use | ( | ) | const [inline, protected] |
void sc_core::sc_semaphore::report_error | ( | const char * | id, | |
const char * | add_msg = 0 | |||
) | const [protected] |
sc_semaphore.cpp の 60 行で定義されています。
00061 { 00062 char msg[BUFSIZ]; 00063 if( add_msg != 0 ) { 00064 std::sprintf( msg, "%s: semaphore '%s'", add_msg, name() ); 00065 } else { 00066 std::sprintf( msg, "semaphore '%s'", name() ); 00067 } 00068 SC_REPORT_ERROR( id, msg ); 00069 }
sc_semaphore& sc_core::sc_semaphore::operator= | ( | const sc_semaphore & | ) | [private] |
sc_event sc_core::sc_semaphore::m_free [protected] |
sc_semaphore.h の 108 行で定義されています。
int sc_core::sc_semaphore::m_value [protected] |
sc_semaphore.h の 109 行で定義されています。