internal static void Initialize() { lock (s_init_lock) { if (s_initialized) { return; } TrinityConfig.EnsureConfig(); CLogInitialize(); s_bgtask = new BackgroundTask(CollectLogEntries, c_LogEntryCollectorIdleInterval); BackgroundThread.AddBackgroundTask(s_bgtask); s_initialized = true; s_logtofile = LoggingConfig.Instance.LogToFile; SetLogDirectory(LoggingConfig.Instance.LogDirectory); } }
/// <summary> /// Initializes the LocalStorage instance. /// </summary> public LocalMemoryStorage() { TrinityConfig.EnsureConfig(); CSynchronizeStorageRoot(); if (TrinityErrorCode.E_SUCCESS != CLocalMemoryStorage.CInitialize()) { //TODO more specific exception type throw new Exception(); } // Register built-in storage event handlers StorageLoaded += InitializeWriteAheadLogFile; StorageLoaded += LoadCellTypeSignatures; StorageSaved += CreateWriteAheadLogFile; StorageSaved += SaveCellTypeSignatures; StorageReset += ResetWriteAheadLog; InitializeWriteAheadLogFile(); Thread.MemoryBarrier(); initialized = true; }