sqldata/sqldb.cpp
// Execute one command for source, another for target in concurrent threads and wait
Execute one command for source, another for target in concurrent threads and wait
Execute one command for source another for target in concurrent threads and wait
int SqlDb::Execute(int cmd1, int cmd2)
{
	_source_ca._cmd = (short)cmd1;
	_target_ca._cmd = (short)cmd2;
#if defined(WIN32) || defined(_WIN64)
	SetEvent(_source_ca._wait_event);
	SetEvent(_target_ca._wait_event);
#else
	Os::SetEvent(&_source_ca._wait_event);
	Os::SetEvent(&_target_ca._wait_event);
#endif
#if defined(WIN32) || defined(_WIN64)
	HANDLE handles[2] = { _source_ca._completed_event, _target_ca._completed_event };
	WaitForMultipleObjects(2, handles, TRUE, INFINITE);
#else
	Os::WaitForEvent(&_source_ca._completed_event);
	Os::WaitForEvent(&_target_ca._completed_event);
#endif
	if(_source_ca.cmd_rc == -1 || _target_ca.cmd_rc == -1)
		return -1;
	return 0;
}
int SqlDb :: Execute ( int cmd1 , int cmd2 ) { _source_ca . _cmd = ( short ) cmd1 ; _target_ca . _cmd = ( short ) cmd2 ; #if defined ( WIN32 ) || defined ( _WIN64 ) SetEvent ( _source_ca . _wait_event ) ; SetEvent ( _target_ca . _wait_event ) ; #else Os :: SetEvent ( & _source_ca . _wait_event ) ; Os :: SetEvent ( & _target_ca . _wait_event ) ; #endif #if defined ( WIN32 ) || defined ( _WIN64 ) HANDLE handles [ 2 ] = { _source_ca . _completed_event , _target_ca . _completed_event } ; WaitForMultipleObjects ( 2 , handles , TRUE , INFINITE ) ; #else Os :: WaitForEvent ( & _source_ca . _completed_event ) ; Os :: WaitForEvent ( & _target_ca . _completed_event ) ; #endif if ( _source_ca . cmd_rc == -1 || _target_ca . cmd_rc == -1 ) return -1 ; return 0 ; }
Execute one command for source, another for target in concurrent threads and wait
Execute one command for source another for target in concurrent threads and wait
// Release the source and target threads to process the command // Wait for the commands completion