jack2 codebase
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.8KB

  1. /*
  2. Copyright (C) 2004-2008 Grame
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  14. */
  15. #if defined(HAVE_CONFIG_H)
  16. #include "config.h"
  17. #endif
  18. #include "JackGlobals.h"
  19. #include "JackError.h"
  20. static bool gKeyRealtimeInitialized = false;
  21. static bool g_key_log_function_initialized = false;
  22. jack_tls_key gRealTime;
  23. jack_tls_key g_key_log_function;
  24. void jack_init()
  25. {
  26. if (!gKeyRealtimeInitialized) {
  27. gKeyRealtimeInitialized = jack_tls_allocate_key(&gRealTime);
  28. }
  29. if (!g_key_log_function_initialized)
  30. g_key_log_function_initialized = jack_tls_allocate_key(&g_key_log_function);
  31. }
  32. void jack_uninit()
  33. {
  34. if (gKeyRealtimeInitialized) {
  35. jack_tls_free_key(gRealTime);
  36. gKeyRealtimeInitialized = false;
  37. }
  38. if (g_key_log_function_initialized) {
  39. jack_tls_free_key(g_key_log_function);
  40. g_key_log_function_initialized = false;
  41. }
  42. }
  43. // Initialisation at library load time
  44. #ifdef WIN32
  45. BOOL WINAPI DllEntryPoint(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
  46. {
  47. switch (fdwReason) {
  48. case DLL_PROCESS_ATTACH:
  49. jack_init();
  50. break;
  51. case DLL_PROCESS_DETACH:
  52. jack_uninit();
  53. break;
  54. }
  55. return TRUE;
  56. }
  57. #endif