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.

65 lines
2.1KB

  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 Lesser General Public License as published by
  5. the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. #include "JackGlobals.h"
  16. namespace Jack
  17. {
  18. bool JackGlobals::fVerbose = 0;
  19. jack_tls_key JackGlobals::fRealTime;
  20. static bool gKeyRealtimeInitialized = jack_tls_allocate_key(&JackGlobals::fRealTime);
  21. jack_tls_key JackGlobals::fKeyLogFunction;
  22. static bool fKeyLogFunctionInitialized = jack_tls_allocate_key(&JackGlobals::fKeyLogFunction);
  23. JackMutex* JackGlobals::fOpenMutex = new JackMutex();
  24. bool JackGlobals::fServerRunning = false;
  25. JackClient* JackGlobals::fClientTable[CLIENT_NUM] = {};
  26. #ifndef WIN32
  27. jack_thread_creator_t JackGlobals::fJackThreadCreator = pthread_create;
  28. #endif
  29. #ifdef __CLIENTDEBUG__
  30. std::ofstream* JackGlobals::fStream = NULL;
  31. void JackGlobals::CheckContext(const char* name)
  32. {
  33. if (JackGlobals::fStream == NULL) {
  34. char provstr[256];
  35. char buffer[256];
  36. time_t curtime;
  37. struct tm *loctime;
  38. /* Get the current time. */
  39. curtime = time (NULL);
  40. /* Convert it to local time representation. */
  41. loctime = localtime (&curtime);
  42. strftime (buffer, 256, "%I-%M", loctime);
  43. sprintf(provstr, "JackAPICall-%s.log", buffer);
  44. JackGlobals::fStream = new std::ofstream(provstr, std::ios_base::ate);
  45. JackGlobals::fStream->is_open();
  46. }
  47. (*fStream) << "JACK API call : " << name << ", calling thread : " << pthread_self() << std::endl;
  48. }
  49. #endif
  50. } // end of namespace