00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "JackGlobals.h"
00021
00022 namespace Jack
00023 {
00024
00025 bool JackGlobals::fVerbose = 0;
00026
00027 jack_tls_key JackGlobals::fRealTimeThread;
00028 static bool gKeyRealtimeThreadInitialized = jack_tls_allocate_key(&JackGlobals::fRealTimeThread);
00029
00030 jack_tls_key JackGlobals::fNotificationThread;
00031 static bool gKeyNotificationThreadInitialized = jack_tls_allocate_key(&JackGlobals::fNotificationThread);
00032
00033 jack_tls_key JackGlobals::fKeyLogFunction;
00034 static bool fKeyLogFunctionInitialized = jack_tls_allocate_key(&JackGlobals::fKeyLogFunction);
00035
00036 JackMutex* JackGlobals::fOpenMutex = new JackMutex();
00037 JackMutex* JackGlobals::fSynchroMutex = new JackMutex();
00038 volatile bool JackGlobals::fServerRunning = false;
00039 JackClient* JackGlobals::fClientTable[CLIENT_NUM] = {};
00040
00041 #ifndef WIN32
00042 jack_thread_creator_t JackGlobals::fJackThreadCreator = pthread_create;
00043 #endif
00044
00045 #ifdef __CLIENTDEBUG__
00046
00047 std::ofstream* JackGlobals::fStream = NULL;
00048
00049 void JackGlobals::CheckContext(const char* name)
00050 {
00051 if (JackGlobals::fStream == NULL) {
00052 char provstr[256];
00053 char buffer[256];
00054 time_t curtime;
00055 struct tm *loctime;
00056
00057 curtime = time (NULL);
00058
00059 loctime = localtime (&curtime);
00060 strftime(buffer, 256, "%I-%M", loctime);
00061 snprintf(provstr, sizeof(provstr), "JackAPICall-%s.log", buffer);
00062 JackGlobals::fStream = new std::ofstream(provstr, std::ios_base::ate);
00063 JackGlobals::fStream->is_open();
00064 }
00065 #ifdef PTHREAD_WIN32
00066 (*fStream) << "JACK API call : " << name << ", calling thread : " << pthread_self().p << std::endl;
00067 #elif defined(WIN32) && !defined(__CYGWIN__)
00068 (*fStream) << "JACK API call : " << name << ", calling thread : " << GetCurrentThread() << std::endl;
00069 #else
00070 (*fStream) << "JACK API call : " << name << ", calling thread : " << pthread_self() << std::endl;
00071 #endif
00072 }
00073
00074 #else
00075
00076 void JackGlobals::CheckContext(const char* name)
00077 {}
00078
00079 #endif
00080
00081 }