BOOL WINAPI DllMain (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved) { (void) hinstDll; (void) lpvReserved; switch (fdwReason) { case DLL_PROCESS_ATTACH: #if (_WIN32_WINNT < 0x0601) if (!QueryPerformanceFrequency (&freq)) return FALSE; #endif vlc_mutex_init (&super_mutex); vlc_cond_init (&super_variable); vlc_threadvar_create (&thread_key, NULL); vlc_rwlock_init (&config_lock); vlc_rwlock_init (&msg_lock); vlc_CPU_init (); break; case DLL_PROCESS_DETACH: vlc_rwlock_destroy (&msg_lock); vlc_rwlock_destroy (&config_lock); vlc_threadvar_delete (&thread_key); vlc_cond_destroy (&super_variable); vlc_mutex_destroy (&super_mutex); break; } return TRUE; }
unsigned long _System _DLL_InitTerm(unsigned long hmod, unsigned long flag) { VLC_UNUSED (hmod); switch (flag) { case 0 : /* Initialization */ if(_CRT_init() == -1) return 0; vlc_mutex_init (&super_mutex); vlc_cond_init (&super_variable); vlc_threadvar_create (&thread_key, NULL); vlc_rwlock_init (&config_lock); vlc_rwlock_init (&msg_lock); vlc_CPU_init (); return 1; case 1 : /* Termination */ vlc_rwlock_destroy (&msg_lock); vlc_rwlock_destroy (&config_lock); vlc_threadvar_delete (&thread_key); vlc_cond_destroy (&super_variable); vlc_mutex_destroy (&super_mutex); _CRT_term(); return 1; } return 0; /* Failed */ }
//BOOL WINAPI DllMain (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved) BOOL WINAPI _CRT_INIT (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved) // sunqueen modify { (void) hinstDll; (void) lpvReserved; switch (fdwReason) { case DLL_PROCESS_ATTACH: InitializeCriticalSection (&clock_lock); vlc_mutex_init (&super_mutex); vlc_cond_init (&super_variable); vlc_threadvar_create (&thread_key, NULL); vlc_rwlock_init (&config_lock); vlc_CPU_init (); break; case DLL_PROCESS_DETACH: vlc_rwlock_destroy (&config_lock); vlc_threadvar_delete (&thread_key); vlc_cond_destroy (&super_variable); vlc_mutex_destroy (&super_mutex); DeleteCriticalSection (&clock_lock); break; } return TRUE; }
/** * Destroy the message queues * * This functions prints all messages remaining in the queues, * then frees all the allocated resources * No other messages interface functions should be called after this one. */ void msg_Destroy (msg_bank_t *bank) { if (unlikely(bank->i_sub != 0)) fputs ("stale interface subscribers (LibVLC might crash)\n", stderr); if (bank->locale != (locale_t)0) freelocale (bank->locale); vlc_dictionary_clear (&bank->enabled_objects, NULL, NULL); vlc_rwlock_destroy (&bank->lock); free (bank); }
/** * Destroy the message queues * * This functions prints all messages remaining in the queues, * then frees all the allocated resources * No other messages interface functions should be called after this one. */ void msg_Destroy (msg_bank_t *bank) { if (unlikely(bank->i_sub != 0)) fputs ("stale interface subscribers (LibVLC might crash)\n", stderr); vlc_mutex_lock( &msg_stack_lock ); assert(banks > 0); if( --banks == 0 ) vlc_threadvar_delete( &msg_context ); vlc_mutex_unlock( &msg_stack_lock ); if (bank->locale != (locale_t)0) freelocale (bank->locale); vlc_dictionary_clear (&bank->enabled_objects, NULL, NULL); vlc_rwlock_destroy (&bank->lock); free (bank); }
void vlc_LogDeinit(libvlc_int_t *vlc) { vlc_logger_t *logger = libvlc_priv(vlc)->logger; if (unlikely(logger == NULL)) return; if (logger->module != NULL) vlc_module_unload(logger->module, vlc_logger_unload, logger->sys); else /* Flush early log messages (corner case: no call to vlc_LogInit()) */ if (logger->log == vlc_vaLogEarly) { logger->log = vlc_vaLogDiscard; vlc_LogEarlyClose(logger, logger->sys); } vlc_rwlock_destroy(&logger->lock); vlc_object_release(logger); libvlc_priv(vlc)->logger = NULL; }
void vlc_LogDeinit (libvlc_int_t *vlc) { libvlc_priv_t *priv = libvlc_priv (vlc); vlc_rwlock_destroy (&priv->log.lock); }