本文整理汇总了C++中CMutex::Destroy方法的典型用法代码示例。如果您正苦于以下问题:C++ CMutex::Destroy方法的具体用法?C++ CMutex::Destroy怎么用?C++ CMutex::Destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMutex
的用法示例。
在下文中一共展示了CMutex::Destroy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bnbtmain
int bnbtmain( )
{
gmtxOutput.Initialize( );
srand( time( NULL ) );
giStartTime = time( NULL );
CFG_Open( CFG_FILE );
CFG_SetDefaults( );
CFG_Close( CFG_FILE );
gstrErrorLogFilePattern = CFG_GetString( "bnbt_error_log_file_pattern", "%Y-%m-%de.log" );
gstrErrorLogDir = CFG_GetString( "bnbt_error_log_dir", string( ) );
if( !gstrErrorLogDir.empty( ) && gstrErrorLogDir[gstrErrorLogDir.size( ) - 1] != PATH_SEP )
gstrErrorLogDir += PATH_SEP;
gpErrorLog = NULL;
gstrAccessLogFilePattern = CFG_GetString( "bnbt_access_log_file_pattern", "%Y-%m-%d.log" );
gstrAccessLogDir = CFG_GetString( "bnbt_access_log_dir", string( ) );
if( !gstrAccessLogDir.empty( ) && gstrAccessLogDir[gstrAccessLogDir.size( ) - 1] != PATH_SEP )
gstrAccessLogDir += PATH_SEP;
gpAccessLog = NULL;
giErrorLogCount = 0;
giAccessLogCount = 0;
giFlushInterval = CFG_GetInt( "bnbt_flush_interval", 100 );
gbDebug = CFG_GetInt( "bnbt_debug", 1 ) == 0 ? false : true;
giMaxConns = CFG_GetInt( "bnbt_max_conns", 64 );
giMaxRecvSize = CFG_GetInt( "bnbt_max_recv_size", 524288 );
gstrStyle = CFG_GetString( "bnbt_style_sheet", string( ) );
gstrCharSet = CFG_GetString( "bnbt_charset", "iso-8859-1" );
gstrRealm = CFG_GetString( "bnbt_realm", "BNBT" );
// start winsock
// TCP window size
giSO_RECBUF = CFG_GetInt( "xbnbt_so_recbuf", 128 ) * 1024;
giSO_SNDBUF = CFG_GetInt( "xbnbt_so_sndbuf", 128 ) * 1024;
#ifdef WIN32
WSADATA wsaData;
int iResult = WSAStartup( MAKEWORD(2,2), &wsaData );
if ( iResult != NO_ERROR )
{
UTIL_LogPrint( "error - unable to start winsock (error %d)\n", GetLastError( ) );
if( gpAccessLog )
fclose( gpAccessLog );
if( gpErrorLog )
fclose( gpErrorLog );
gmtxOutput.Destroy( );
return 1;
}
#endif
// start mysql
#ifdef BNBT_MYSQL
if( !( gpMySQL = mysql_init( NULL ) ) )
{
UTIL_LogPrint( "mysql error - %s\n", mysql_error( gpMySQL ) );
if( gpAccessLog )
fclose( gpAccessLog );
if( gpErrorLog )
fclose( gpErrorLog );
gmtxOutput.Destroy( );
return 1;
}
gstrMySQLHost = CFG_GetString( "mysql_host", string( ) );
gstrMySQLDatabase = CFG_GetString( "mysql_database", "bnbt" );
gstrMySQLUser = CFG_GetString( "mysql_user", string( ) );
gstrMySQLPassword = CFG_GetString( "mysql_password", string( ) );
giMySQLPort = CFG_GetInt( "mysql_port", 0 );
if( !( mysql_real_connect( gpMySQL, gstrMySQLHost.c_str( ), gstrMySQLUser.c_str( ), gstrMySQLPassword.c_str( ), gstrMySQLDatabase.c_str( ), giMySQLPort, NULL, 0 ) ) )
{
UTIL_LogPrint( "mysql error - %s\n", mysql_error( gpMySQL ) );
if( gpAccessLog )
fclose( gpAccessLog );
if( gpErrorLog )
fclose( gpErrorLog );
gmtxOutput.Destroy( );
return 1;
//.........这里部分代码省略.........
示例2: bnbtmain
int bnbtmain( )
{
gmtxOutput.Initialize( );
srand( time( NULL ) );
giStartTime = time( NULL );
CFG_Open( CFG_FILE );
CFG_SetDefaults( );
CFG_Close( CFG_FILE );
gstrErrorLogDir = CFG_GetString( "bnbt_error_log_dir", string( ) );
if( !gstrErrorLogDir.empty( ) && gstrErrorLogDir[gstrErrorLogDir.size( ) - 1] != PATH_SEP )
gstrErrorLogDir += PATH_SEP;
gpErrorLog = NULL;
gstrAccessLogDir = CFG_GetString( "bnbt_access_log_dir", string( ) );
if( !gstrAccessLogDir.empty( ) && gstrAccessLogDir[gstrAccessLogDir.size( ) - 1] != PATH_SEP )
gstrAccessLogDir += PATH_SEP;
gpAccessLog = NULL;
giErrorLogCount = 0;
giAccessLogCount = 0;
giFlushInterval = CFG_GetInt( "bnbt_flush_interval", 100 );
gbDebug = CFG_GetInt( "bnbt_debug", 1 ) == 0 ? false : true;
giMaxConns = CFG_GetInt( "bnbt_max_conns", 64 );
gstrStyle = CFG_GetString( "bnbt_style_sheet", string( ) );
gstrCharSet = CFG_GetString( "bnbt_charset", "iso-8859-1" );
gstrRealm = CFG_GetString( "bnbt_realm", "BNBT" );
// The Trinity Edition - Addition Begins
// Sets the value for the Custom NT Service Name variable
gstrNTServiceName = CFG_GetString( "trinity_nt_service_name", "BNBT Service" );
// Sets the "bnbt_alt_signup_url" value
gstrAltSignupURL = CFG_GetString( "bnbt_alt_signup_url", string( ) );
// Sets the "bnbt_tracker_title" value
gstrTrackerTitle = CFG_GetString( "bnbt_tracker_title", string( ) );
// Sets the "bnbt_external_js" value
gstrExternalJavascript = CFG_GetString( "bnbt_external_js", string( ) );
// --------------------------------------- End of Addition
// start winsock
#ifdef WIN32
WSADATA wsadata;
if( WSAStartup( MAKEWORD( 2, 0 ), &wsadata ) != 0 )
{
UTIL_LogPrint( "error - unable to start winsock (error %d)\n", GetLastError( ) );
if( gpAccessLog )
fclose( gpAccessLog );
if( gpErrorLog )
fclose( gpErrorLog );
gmtxOutput.Destroy( );
return 1;
}
#endif
gpServer = new CServer( );
gpLink = NULL;
gpLinkServer = NULL;
if( CFG_GetInt( "bnbt_tlink_server", 0 ) != 0 )
gpLinkServer = new CLinkServer( );
else
{
if( !CFG_GetString( "bnbt_tlink_connect", string( ) ).empty( ) )
{
#ifdef WIN32
if( _beginthread( ( void (*)(void *) )StartLink, 0, NULL ) == -1 )
UTIL_LogPrint( "error - unable to spawn link thread\n" );
#else
pthread_t thread;
// set detached state since we don't need to join with any threads
pthread_attr_t attr;
pthread_attr_init( &attr );
pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
int c = pthread_create( &thread, &attr, ( void * (*)(void *) )StartLink, NULL );
if( c != 0 )
UTIL_LogPrint( "error - unable to spawn link thread (error %s)\n", strerror( c ) );
#endif
}
}
while( 1 )
{
if( gpServer->Update( true ) )
{
delete gpServer;
//.........这里部分代码省略.........
示例3: bnbtmain
//.........这里部分代码省略.........
UTIL_DeleteFile( gstrPID.c_str( ) );
}
// Close the log
if( gpLog )
{
if( gbDebug && ( gucDebugLevel & DEBUG_BNBT ) )
UTIL_LogPrint( "Closing the log\n" );
fclose( gpLog );
}
// Close the access log
if( gpAccessLog )
{
if( gbDebug && ( gucDebugLevel & DEBUG_BNBT ) )
UTIL_LogPrint( "Closing the access log\n" );
fclose( gpAccessLog );
}
// Close the error log
if( gpErrorLog )
{
if( gbDebug && ( gucDebugLevel & DEBUG_BNBT ) )
UTIL_LogPrint( "Closing the error log\n" );
fclose( gpErrorLog );
}
UTIL_LogPrint( "Tracker Stop\n" );
gmtxMySQL.Destroy( );
gmtxOutput.Destroy( );
return 1;
}
#endif
// start mysql
if( gbDebug )
if( gucDebugLevel & DEBUG_BNBT )
UTIL_LogPrint( "Setting MySQL dstate global variables\n" );
if( !( gpMySQL = mysql_init( 0 ) ) )
{
UTIL_LogPrint( ( gmapLANG_CFG["bnbt_mysql_error"] + "\n" ).c_str( ), mysql_error( gpMySQL ) );
// Delete the PID file
if( !gstrPID.empty( ) )
{
if( gbDebug )
if( gucDebugLevel & DEBUG_BNBT )
UTIL_LogPrint( "Deleting the PID file\n" );
UTIL_DeleteFile( gstrPID.c_str( ) );
}
// Close the log
if( gpLog )
{
if( gbDebug )
if( gucDebugLevel & DEBUG_BNBT )
UTIL_LogPrint( "Closing the log\n" );