• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ CleanUp函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中CleanUp函数的典型用法代码示例。如果您正苦于以下问题:C++ CleanUp函数的具体用法?C++ CleanUp怎么用?C++ CleanUp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了CleanUp函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: CleanUp

//-------------------------------------------------------------------//
// RunInstalledVersion()															//
//-------------------------------------------------------------------//
// This function is called if an EXE was run other than the one in
// the install path.  It will set up to run the installed version.
// After returning from this function, the caller should quickly
// exit the currently running program.
//
// This function can update the installed version of the program with
// the one currently running, if bUpdate is true.
//
// This is not a straightforward task, because we cannot copy
// ourselves while we are running - Windows has the file exclusively
// locked.
//
// Instead, we fire off a hidden batch file.  The batch file polls
// for a successful copy of this executable over the installed
// version.  It will have to keep trying up until the point where
// this executable exits.  So once we call this function, we want
// to exit the app as quickly as possible, so the whole machine 
// does not grind to a halt.  Note that the batch file's process is
// manhandled by this function to minimize its impact.
//
// An article in MSDN ( MSJ, Win Q & A, Deleting an executable ) has
// a comprehensive discussion of the problem of operating on the
// file of a running executable.  The concept and original code were
// taken from there.
//-------------------------------------------------------------------//
void BaseApp::RunInstalledVersion(
	bool bUpdate
) {
	// Delete the shared memory, so the installed version can create it
	// properly on its own.
	CleanUp();

	// We want to get the short filename for the installation directory.
	// Make sure we create it first, or GetShortFilename() returns a blank string!!
	VERIFY( MakeDir( m_strRegistryPath ) );
	
	CString strRegistryFilename = AddTrailingBackslash( GetShortFilename( m_strRegistryPath ) ) + m_strExeName;

	if ( !bUpdate )
	{
		ShellExecute(
			NULL,
			_T("open"),
			LPCTSTR( m_strExeName ),
			LPCTSTR( pCommandLine->m_strFileName ),	// pointer to string that specifies executable-file parameters.
			LPCTSTR( m_strRegistryPath ),					// pointer to string that specifies default directory.
			SW_SHOW				  								// whether file is shown when opened.
		);
	}
	else 
	{
		// Get the current filename.  Convert it to a short name, 
		// so the batch file works.
		CString strCurrentFilename = GetShortFilename( GetProgramFilename() );

		// We now replace the installed version of the EXE using
		// a batch file.

		// We need to do some prepping.
		// We need to make sure the installed file is deleted before we
		// call the batch file.  It polls for existance of the file, and
		// we don't want it to find it until we successfully copied it.
		// We could let the batch file do this, but minimizing the batch
		// file's requirements helps us minimize its impact.  Besides,
		// this may not succeed.  Typically, this fails if the executable is
		// already running.  If so, the user is prolly farting around.  We just exit.
		bool bInstallIsDeleted = !bFileExists( strRegistryFilename );
		if ( !bInstallIsDeleted )
			bInstallIsDeleted = ( DeleteFile( strRegistryFilename ) != FALSE );

		if ( bInstallIsDeleted )
		{

			// Create a temporary batch file.
			// We create it in c:\.
			// TO DO
			// Consider using %TEMP%.
			#define BATCH_FILE_NAME _T("c:\\Temp.bat")
			#define BATCH_FILE_PATH _T("c:\\")

			HANDLE hfile;
			STARTUPINFO si;
			PROCESS_INFORMATION pi;

			hfile = CreateFile(
				BATCH_FILE_NAME, 
				GENERIC_WRITE, 
				0, 
				NULL, 
				CREATE_ALWAYS,                             
				FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, 
				NULL
			);
			if ( hfile != INVALID_HANDLE_VALUE ) 
			{
				// Construct the lines for the batch file.
				CString strBatFile;
//.........这里部分代码省略.........
开发者ID:moodboom,项目名称:Reusable,代码行数:101,代码来源:BaseApp.cpp


示例2: CleanUp

CWayPointManager::~CWayPointManager()
{
	CleanUp();
}
开发者ID:kusku,项目名称:red-forest,代码行数:4,代码来源:WayPointManager.cpp


示例3: CleanUp

cSkinnedMesh::~cSkinnedMesh()
{
	CleanUp();
}
开发者ID:NeuroWhAI,项目名称:WhatBox,代码行数:4,代码来源:cSkinnedMesh.cpp


示例4: CleanUp

CParticleSettingsManager::~CParticleSettingsManager()
{
	CleanUp();
}
开发者ID:kusku,项目名称:red-forest,代码行数:4,代码来源:ParticleSettingsManager.cpp


示例5: CleanUp

	CException::~CException() {
		CleanUp();
	};
开发者ID:tongko,项目名称:CommandPromptWindows,代码行数:3,代码来源:Exception.cpp


示例6: CleanUp

p4dn::Error::~Error( void )
{
	CleanUp();
}
开发者ID:yoiang,项目名称:Google-Code-Dump,代码行数:4,代码来源:Error_m.cpp


示例7: ERROR_INFO


//.........这里部分代码省略.........
                if (m_Rslt == MEASUREMENT_VALID)
                {
                    if (m_backlashResultMs >= 0.8 * m_northPulseCount * m_pulseWidth)
                        m_Rslt = MEASUREMENT_IMPAIRED;      // May not have moved far enough north for accurate measurement
                }
                Debug.AddLine(wxString::Format("BLT: Backlash amount is %0.2f px, %d ms", m_backlashResultPx, m_backlashResultMs));
                // Don't try this refinement if the clearing pulse will cause us to lose the star
                if (m_backlashResultPx < pFrame->pGuider->GetMaxMovePixels())
                {
                    m_lastStatus = wxString::Format(_("Issuing test backlash correction of %d ms"), m_backlashResultMs);
                    Debug.AddLine(m_lastStatus);
                    // This should put us back roughly to where we issued the big North pulse unless the backlash is very large
                    pFrame->ScheduleCalibrationMove(m_scope, SOUTH, m_backlashResultMs);
                    m_stepCount++;
                }
                else
                {
                    int maxFrameMove = (int)floor((double)pFrame->pGuider->GetMaxMovePixels() / m_northRate);
                    Debug.AddLine(wxString::Format("BLT: Clearing pulse is very large, issuing max S move of %d", maxFrameMove));
                    pFrame->ScheduleCalibrationMove(m_scope, SOUTH, maxFrameMove);       // One more pulse to cycle the state machine
                    m_bltState = BLT_STATE_RESTORE;
                }
                break;
            }
            // See how close we came, maybe fine-tune a bit
            Debug.AddLine(wxString::Format("BLT: Trial backlash pulse resulted in net DecDelta = %0.2f px, Dec Location %0.2f", decDelta, currMountLocation.Y));
            if (fabs(decDelta) > TRIAL_TOLERANCE)
            {
                double pulse_delta = fabs(currMountLocation.Y - m_endSouth.Y);
                if ((m_endSouth.Y - m_markerPoint.Y) * decDelta < 0)                // Sign change, went too far
                {
                    m_backlashResultMs *= m_backlashResultPx / pulse_delta;
                    Debug.AddLine(wxString::Format("BLT: Trial backlash resulted in overshoot - adjusting pulse size by %0.2f", m_backlashResultPx / pulse_delta));
                }
                else
                {
                    double corr_factor = (m_backlashResultPx / pulse_delta - 1.0) * 0.5 + 1.0;          // apply 50% of the correction to avoid over-shoot
                    //m_backlashResultMs *= corr_factor;
                    Debug.AddLine(wxString::Format("BLT: Trial backlash resulted in under-correction - under-shot by %0.2f", corr_factor));
                }
            }
            else
                Debug.AddLine("BLT: Initial backlash pulse resulted in final delta of < 2 px");

            m_bltState = BLT_STATE_RESTORE;
            m_stepCount = 0;
            // fall through

        case BLT_STATE_RESTORE:
            // We could be a considerable distance from where we started, so get back close to the starting point without losing the star
            if (m_stepCount == 0)
            {
                Debug.AddLine(wxString::Format("BLT: Starting Dec position at %0.2f, Ending Dec position at %0.2f", m_markerPoint.Y, currMountLocation.Y));
                amt = fabs(currMountLocation.Y - m_startingPoint.Y);
                if (amt > pFrame->pGuider->GetMaxMovePixels())
                {
                    m_restoreCount = (int)floor((amt / m_northRate) / m_pulseWidth);
                    Debug.AddLine(wxString::Format("BLT: Final restore distance is %0.1f px, approx %d steps", amt, m_restoreCount));
                    m_stepCount = 0;
                }
                else
                    m_bltState = BLT_STATE_WRAPUP;
            }
            if (m_stepCount < m_restoreCount)
            {

                pFrame->ScheduleCalibrationMove(m_scope, SOUTH, m_pulseWidth);
                m_stepCount++;
                m_lastStatus = _("Restoring star position");
                Debug.AddLine("BLT: Issuing restore pulse count %d of %d ms", m_stepCount, m_pulseWidth);
                break;
            }
            m_bltState = BLT_STATE_WRAPUP;
            // fall through

        case BLT_STATE_WRAPUP:
            m_lastStatus = _("Measurement complete");
            CleanUp();
            m_bltState = BLT_STATE_COMPLETED;
            break;

        case BLT_STATE_COMPLETED:
            break;

        case BLT_STATE_ABORTED:
            m_lastStatus = _("Measurement halted");
            Debug.AddLine("BLT: measurement process halted by user");
            CleanUp();
            break;
        }                       // end of switch on state
    }
    catch (const wxString& msg)
    {
        Debug.AddLine(wxString::Format("BLT: Exception thrown in logical state %d", (int)m_bltState));
        m_bltState = BLT_STATE_ABORTED;
        m_lastStatus = _("Measurement encountered an error: " + msg);
        Debug.AddLine("BLT: " + m_lastStatus);
        CleanUp();
    }
}
开发者ID:xeqtr1982,项目名称:phd2,代码行数:101,代码来源:backlash_comp.cpp


示例8: CleanUp

 MaleFirstNameDataFileRecordTestCases::~MaleFirstNameDataFileRecordTestCases()
 {
     CleanUp( &dfr1 );
 }
开发者ID:VincentS,项目名称:TPCE,代码行数:4,代码来源:MaleFirstNameDataFileRecordTestCases.cpp


示例9: Cancel

 virtual void Cancel()
 {
     CleanUp();
     //our object has been destructed at this point
 }
开发者ID:randomcoding,项目名称:PlaneShift-PSAI,代码行数:5,代码来源:questionclient.cpp


示例10: main

int main (int argc, const char * argv[]) {
	/* Init stack pointers, capitilization shows priority and letter describes direction */
	EStack = (TStack *)malloc(sizeof(TStack));	
	eStack = (TStack *)malloc(sizeof(TStack));
	WStack = (TStack *)malloc(sizeof(TStack));
	wStack = (TStack *)malloc(sizeof(TStack));

	EStack->Head = NULL; eStack->Head = NULL; WStack->Head = NULL; wStack->Head = NULL;
	EStack->Count = 0; eStack->Count = 0; WStack->Count = 0; wStack->Count = 0;
	EStack->StackUse = 0; eStack->StackUse = 0; WStack->StackUse = 0; wStack->StackUse = 0;
	
	/* init parameters */
	inFileName = argv[1];
	NumTrains = atoi(argv[2]); TrainsFinished = 0;TrackInUse = 0;
	LastDirection = (char*)malloc(sizeof(char)*4);
	strcpy(LastDirection, "East");
	
	if (inFileName == NULL || NumTrains == 0) {
		printf("Usage : ./mts [inputfile] [number of trains]\n");
		return 1;
	}
	
	/* init stack mutexes */
	pthread_mutex_init (&eStack->Mutex, NULL);pthread_mutex_init (&wStack->Mutex, NULL);pthread_mutex_init (&WStack->Mutex, NULL);
	pthread_mutex_init (&EStack->Mutex, NULL);pthread_cond_init  (&EStack->Cv, NULL);pthread_cond_init  (&eStack->Cv, NULL);
	pthread_cond_init  (&WStack->Cv, NULL);pthread_cond_init  (&wStack->Cv, NULL);pthread_mutex_init (&TrackMutex, NULL);
	pthread_cond_init  (&TrackState, NULL);
		
	ReadFile();			/* Read the file, and setup the Loading array */
	int i = 0;
	for (LoadingCurrent = LoadingThreads; i < NumTrains; LoadingCurrent++) {
		pthread_mutex_init(&LoadingCurrent->TMutex, NULL);
		pthread_cond_init(&LoadingCurrent->TState, NULL);
		pthread_create(&LoadingCurrent->tid, NULL, train, (void *)LoadingCurrent);
		i++;	
	}

	/* Main scheduling loop, wait until all trains are finished. */
	while (TrainsFinished < NumTrains) {
		if (TrackInUse) {
			pthread_cond_wait(&TrackState, &TrackMutex);
			pthread_mutex_unlock(&TrackMutex);
			if (TrainsFinished == NumTrains)
				break;
		}
		if (EStack->Count || WStack->Count) {		/* EStack or WStack is not NULL */
			if (EStack->Count && WStack->Count) {
				if (strcmp(LastDirection, "East") == 0) {		/* if the last direction was east, send west */
					pthread_mutex_lock(&TrackMutex);
					pthread_cond_signal(&WStack->Current->TState);
				}
				else {
					pthread_mutex_lock(&TrackMutex);
					pthread_cond_signal(&EStack->Current->TState);
				}
			}
			else if (EStack->Count) {		/* If EStack is not NULL */
				pthread_mutex_lock(&TrackMutex);
				pthread_cond_signal(&EStack->Current->TState);
			}
			else if (WStack->Count) {		/* If WStack is not NULL */
				pthread_mutex_lock(&TrackMutex);
				pthread_cond_signal(&WStack->Current->TState);
			}
		}
		else if (wStack->Count || eStack->Count)	{		/* eStack or wStack != NULL */
			if (eStack->Count && wStack->Count) {
				if (strcmp(LastDirection, "East") == 0) {	/* if the last direction was east, send west */
					pthread_mutex_lock(&TrackMutex);
					pthread_cond_signal(&wStack->Current->TState);
				}
				else {
					pthread_mutex_lock(&TrackMutex);
					pthread_cond_signal(&eStack->Current->TState);
				}
			}
			else if (eStack->Count) {		/* if the low pri east stack is not NULL */
				pthread_mutex_lock(&TrackMutex);
				pthread_cond_signal(&eStack->Current->TState);
			}
			else if (wStack->Count) {		/* if the low pri west stack is not NULL */
				pthread_mutex_lock(&TrackMutex);
				pthread_cond_signal(&wStack->Current->TState);
			}
		}
		pthread_mutex_unlock(&TrackMutex);
	}
	CleanUp();
	pthread_exit(NULL);
}
开发者ID:bradens,项目名称:uvc,代码行数:90,代码来源:mts.c


示例11: main

int __cdecl main(int argc, char *argv[])
{

    HANDLE hFile = NULL;
    DWORD dwBytesWritten;
    const char* hugeStringTest =
        "1234567890123456789012345678901234567890";
    const char* szWritableFile = "writeable.txt";
    int i =0;
    if (0 != PAL_Initialize(argc,argv))
    {
        return FAIL;
    }

    /* create the test file         */
    hFile = CreateFile(szWritableFile, 
        GENERIC_WRITE,
        FILE_SHARE_WRITE,
        NULL,
        CREATE_ALWAYS,
        FILE_ATTRIBUTE_NORMAL,
        NULL);

    if(hFile == INVALID_HANDLE_VALUE)
    {
        Fail("WriteFile: ERROR -> Unable to create file \"%s\".\n", 
            szWritableFile);
    }   

    /* write 4000 000 chars to the file.*/
    for (i=0; i<100000;i++)
    {
        if( WriteFile(hFile,        /* HANDLE handle to file    */
            hugeStringTest,         /* data buffer              */
            strlen(hugeStringTest), /* number of bytes to write */
            &dwBytesWritten,        /* number of bytes written  */
            NULL)                   /* overlapped buffer        */
            ==0)
        {
            Trace("WriteFile: ERROR -> Unable to write to file error: %ld \n",
                GetLastError());
            CleanUp(hFile,szWritableFile);
            Fail("");

        }
    }

    if(!FlushFileBuffers(hFile))
    {
        Trace("WriteFile: ERROR -> Call to FlushFileBuffers failed"
              "error %ld \n",GetLastError());
        CleanUp(hFile,szWritableFile);        
        Fail("");
    }

    /* test if the size changed properly. */
    if(GetFileSize(hFile,NULL) != 4000000)
    {
        Trace("WriteFile: ERROR -> file size did not change properly"
            " after writing 4000 000 chars to it ( size= %u )\n",                   
            GetFileSize(hFile,NULL));
        CleanUp(hFile,szWritableFile); 
        Fail("");

    }

    if (!CleanUp(hFile,szWritableFile))
    {
        Fail("");
    }

    PAL_Terminate();
    return PASS;
}
开发者ID:smartmaster,项目名称:sscli,代码行数:74,代码来源:writefile.c


示例12: CleanUp

/** 
 *  Schliesst das Fenster.
 *
 *  @author FloSoft
 */
void VideoSDL::DestroyScreen(void)
{
	// Fenster schliessen
	CleanUp();
	Initialize();
}
开发者ID:MiyaxinPittahai,项目名称:s25rttr,代码行数:11,代码来源:SDL.cpp


示例13: CleanUp

ResultSet::~ResultSet()
{
    CleanUp();
}
开发者ID:madisodr,项目名称:legacy-core,代码行数:4,代码来源:QueryResult.cpp


示例14: m_rowCount


//.........这里部分代码省略.........
m_length(NULL)
{
    if (!m_res)
        return;

    if (m_stmt->bind_result_done)
    {
        delete[] m_stmt->bind->length;
        delete[] m_stmt->bind->is_null;
    }

    m_rBind = new MYSQL_BIND[m_fieldCount];
    m_isNull = new my_bool[m_fieldCount];
    m_length = new unsigned long[m_fieldCount];

    memset(m_isNull, 0, sizeof(my_bool) * m_fieldCount);
    memset(m_rBind, 0, sizeof(MYSQL_BIND) * m_fieldCount);
    memset(m_length, 0, sizeof(unsigned long) * m_fieldCount);

    //- This is where we store the (entire) resultset
    if (mysql_stmt_store_result(m_stmt))
    {
        TC_LOG_WARN("sql.sql", "%s:mysql_stmt_store_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt));
        delete[] m_rBind;
        delete[] m_isNull;
        delete[] m_length;
        return;
    }

    //- This is where we prepare the buffer based on metadata
    uint32 i = 0;
    MYSQL_FIELD* field = mysql_fetch_field(m_res);
    while (field)
    {
        size_t size = Field::SizeForType(field);

        m_rBind[i].buffer_type = field->type;
        m_rBind[i].buffer = malloc(size);
        memset(m_rBind[i].buffer, 0, size);
        m_rBind[i].buffer_length = size;
        m_rBind[i].length = &m_length[i];
        m_rBind[i].is_null = &m_isNull[i];
        m_rBind[i].error = NULL;
        m_rBind[i].is_unsigned = field->flags & UNSIGNED_FLAG;

        ++i;
        field = mysql_fetch_field(m_res);
    }

    //- This is where we bind the bind the buffer to the statement
    if (mysql_stmt_bind_result(m_stmt, m_rBind))
    {
        TC_LOG_WARN("sql.sql", "%s:mysql_stmt_bind_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt));
        delete[] m_rBind;
        delete[] m_isNull;
        delete[] m_length;
        return;
    }

    m_rowCount = mysql_stmt_num_rows(m_stmt);

    m_rows.resize(uint32(m_rowCount));
    while (_NextRow())
    {
        m_rows[uint32(m_rowPosition)] = new Field[m_fieldCount];
        for (uint64 fIndex = 0; fIndex < m_fieldCount; ++fIndex)
        {
            if (!*m_rBind[fIndex].is_null)
                m_rows[uint32(m_rowPosition)][fIndex].SetByteValue(m_rBind[fIndex].buffer,
                                                            m_rBind[fIndex].buffer_length,
                                                            m_rBind[fIndex].buffer_type,
                                                           *m_rBind[fIndex].length);
            else
                switch (m_rBind[fIndex].buffer_type)
                {
                    case MYSQL_TYPE_TINY_BLOB:
                    case MYSQL_TYPE_MEDIUM_BLOB:
                    case MYSQL_TYPE_LONG_BLOB:
                    case MYSQL_TYPE_BLOB:
                    case MYSQL_TYPE_STRING:
                    case MYSQL_TYPE_VAR_STRING:
                    m_rows[uint32(m_rowPosition)][fIndex].SetByteValue("",
                                                            m_rBind[fIndex].buffer_length,
                                                            m_rBind[fIndex].buffer_type,
                                                           *m_rBind[fIndex].length);
                    break;
                    default:
                    m_rows[uint32(m_rowPosition)][fIndex].SetByteValue(nullptr,
                                                            m_rBind[fIndex].buffer_length,
                                                            m_rBind[fIndex].buffer_type,
                                                           *m_rBind[fIndex].length);
                }
        }
        m_rowPosition++;
    }
    m_rowPosition = 0;

    /// All data is buffered, let go of mysql c api structures
    CleanUp();
}
开发者ID:madisodr,项目名称:legacy-core,代码行数:101,代码来源:QueryResult.cpp


示例15: CleanUp

/*
================
idEntityFx::Stop
================
*/
void idEntityFx::Stop( void ) {
	CleanUp();
	started = -1;
}
开发者ID:alepulver,项目名称:dhewm3,代码行数:9,代码来源:Fx.cpp


示例16: CleanUp

/**
 *  Destruktor der DriverWrapper Klasse.
 *
 *  @author FloSoft
 */
VideoDriverWrapper::~VideoDriverWrapper()
{
    CleanUp();
}
开发者ID:lweberk,项目名称:s25client,代码行数:9,代码来源:VideoDriverWrapper.cpp


示例17: CleanUp

 Device::~Device()
 {
   CleanUp();
 }
开发者ID:Marktopus,项目名称:WickedSickEngine,代码行数:4,代码来源:Device.cpp


示例18: DllRelease

CLangBarItemButton::~CLangBarItemButton()
{
    DllRelease();
    CleanUp();
}
开发者ID:takashiro,项目名称:Scoreweaver,代码行数:5,代码来源:LanguageBar.cpp


示例19: CleanUp

CALSound::~CALSound()
{
    CleanUp();
}
开发者ID:CyborgMaster,项目名称:colobot,代码行数:4,代码来源:alsound.cpp


示例20: main


//.........这里部分代码省略.........
				if (payguide::free_worker!=NULL)
				{
					LaunchNewPay(new_pay);
					new_pay=NULL;
					sem_post(&payguide::free_workers_lock);	
				}
				
				/* We can't create a new worker - threads limit hit. */
				else
				{
					//LogWrite(LOGMSG_WARNING, "Threads limit hit. Payguide server is overloaded.");
					sem_post(&payguide::free_workers_lock);
					
					if (sleep_count==20)
					{
						ReloadConfigIfImportant();
						ManagerEx();
						sleep_count=0;
						
					}

					nanosleep(&req, NULL);sleep_count++;
					StatisticTick(0.2);

					
				}
			}
			
			/* No new pays, sleep (nojobs_sleep_time) sec*/
			else
			{
				
				/* Manage inactive workers */
				if (sleep_count==20)
				{
					ReloadConfigIfImportant();
					ManagerEx();
					sleep_count=0;
				}
//				sleep(SLEEP_TIME); sleep_count=20;
				nanosleep(&req, NULL);sleep_count++;
				StatisticTick(0.2);

			}
		}
		
		/* Waiting for all workers, or even cancel all pays if force_quit is 1 ... */
		LogWrite(LOGMSG_SYSTEM, "Waiting for all active pays to end - for safe exit - you had to specify right timeouts in your modules.");
		WaitForAllPaysToFinish(force_quit);
		
		/* If it's not reboot - exit */
		sem_wait(&payguide::shutdown_lock);
		bool quit_state=payguide::quit;
		sem_post(&payguide::shutdown_lock);
		if (quit_state)
		{
			LogWrite(LOGMSG_SYSTEM, "Payguide server shutdown normally.");
			LogWrite(LOGMSG_SYSTEM, "Bye-bye!");
			
			/* Stop connection with MySQL database */
			DBShutdown();
		
			/* Stop control server. */
			//CtlServerStop();
			
			mysql_library_end();
			
			if (ossl_lock!=NULL)
				delete [] ossl_lock;
			if (pc_init_result==0)
				PCShutdown();
			/* CleanUp will be automatically called by atexit() function */
			if (RemoveLockFile()!=0)
			{
				std::cout << "Can't remove /tmp/payguide.lock. File doesn't exist or maybe you should delete it manually."  << std::endl;
				LogWrite(LOGMSG_CRITICAL, "Can't remove /tmp/payguide.lock. File doesn't exist or maybe you should delete it manually.");
			}
			OperatorsShutdown();
			EVP_cleanup();
			payguide::data_conventor.Clean();
			PerlShutdown();
			printf("destroying queue\n");
			in_manager.Destroy();
			printf("done\n");
			exit (0);
		}
		
		/* Stop connection with MySQL database */
		DBShutdown();
		
		printf("destroying queue\n");
		in_manager.Destroy();
		printf("done\n");
	        server_code.Kill();
		LogWrite(LOGMSG_SYSTEM, "Rebooting...");
		work_init_already=false;
		CleanUp();
	}
	return 0;
}
开发者ID:s-alexander,项目名称:UPGM,代码行数:101,代码来源:main.cpp



注:本文中的CleanUp函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Clear函数代码示例发布时间:2022-05-30
下一篇:
C++ Clean函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap