Esempio n. 1
0
int ProcessorMap::LogicalToPhysical(int lproc) const { 
  IntegrityCheck();
  if( lproc < 0 || lproc >= m_nProcs ) {
    fatal( "Logical processor number out of range: [%i,%i) (%i)",0,m_nProcs,lproc);
  }

  return m_p_nProcessor_Ids[lproc];
} 
Esempio n. 2
0
void Database::DoBackup() {
    QSqlDatabase db(this->Connect());

    // Before we overwrite anything, make sure the database is not corrupt
    QMutexLocker l(&mutex_);
    const bool ok = IntegrityCheck(db);

    if (ok) {
        BackupFile(db.databaseName());
    }
}
Esempio n. 3
0
int ProcessorMap::PhysicalToLogical(int pproc) const { 
  IntegrityCheck();

  int i;
  for(i=0;i<m_nProcs;i++) {
    if( m_p_nProcessor_Ids[i] == pproc ) break;
  }

  if( i == m_nProcs ) {
    fatal( "Physical processor number does not match any known physical processor numbers.");
  }

  return i;
} 
Esempio n. 4
0
bool SQLiteHelper::OpenDatabase( bool inIntegrityCheck )
{
	struct stat statBuffer	= { 0 };
	
	fMutex.WaitLock();
	
	if ( fDatabase == NULL ) {
		if ( stat(fDatabasePath, &statBuffer) == 0 && statBuffer.st_size == 0 ) {
			inIntegrityCheck = false;
			CreateDatabase();
		}
		else {
			// if it fails to open here, we'll remove the file and attempt to open it again in the next if
			int status = sqlite3_open( fDatabasePath, &fDatabase );
			if ( SQLITE_OK != status ) {
				inIntegrityCheck = false;
				CreateDatabase();
			}
		}
	}
	
	if ( fDatabase != NULL ) {
		if ( (true == inIntegrityCheck && IntegrityCheck() == false) || IsDatabaseVersionCurrent() == false ) {
			CreateDatabase();
		}
	}
	
	// we lower the cache size to bare minimum, none of our tables are big enough and we have no need for cache
	// we don't do complex queries that require multiple rows in memory
	// let the disk cache for the system do most of the work as our indexes shouldn't be too large
	ExecSync( "PRAGMA cache_size = 2" ); // 4k is plenty for anything we do
	
	fMutex.SignalLock();
	
	return (fDatabase != NULL);
}
Esempio n. 5
0
File: osctl.c Progetto: sdvos/sdvos
void
StartOS (AppModeType mode)
{
  /* Set application mode */
  sdvos_appmode = mode;

  /*
   * Initialize the MCU we are using. This involves low
   * level initialization which usually at least include
   * a stack switch after disabling interrupts globally for
   * initialization. It is OK because StartOS will never
   * return and we already processed the parameter.
   * Procedures after this call will be carried out in
   * SDVOS kernel context.
   *
   * McuInit can either be a C function, assembly function
   * or a macro on different platforms.
   */
  McuInit ();

  /*
   * Board specific initialization. Might include clock
   * configuration, flash setup, etc.
   */
  BoardInit ();

  /* Initialize Interrupt Handling */
  InterruptInit ();

  /* Initialize all the drivers configured */
  DriversInit ();

  /* Activate auto start tasks */
  TaskAutoStart (sdvos_appmode);

  /* Initialize Alarm/Counter */
  AlarmInit ();

#ifdef USE_SCHEDTBL
  /*
   * Initialize schedule table. This is mostly schedule
   * table auto start. And it has to be done after task
   * and alarm auto start. [SWS_Os_00510]
   */
  ScheduleTableInit ();
#endif

  /*
   * StartupHook is called by the OS at the end of the
   * initialization and before the scheduler is running.
   */
  STARTUPHOOK ();

#ifdef DEBUG_SDVOS_VERBOSE
  IntegrityCheck ();
#endif

#ifdef PRINT_BANNER
  PrintBanner ();
#endif

  DEBUG_PRINTF ("Starting SDVOS in mode %d...\n", sdvos_appmode);

  /* Switch to the first user task */
  JumpNext ();

  /* Should never reach here */
  return;
}