Jack2 1.9.6
|
00001 /* 00002 Copyright (C) 2004-2008 Grame 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU Lesser General Public License as published by 00006 the Free Software Foundation; either version 2.1 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU Lesser General Public License for more details. 00013 00014 You should have received a copy of the GNU Lesser General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 00018 */ 00019 00020 #include "JackGlobals.h" 00021 00022 namespace Jack 00023 { 00024 00025 bool JackGlobals::fVerbose = 0; 00026 00027 jack_tls_key JackGlobals::fRealTime; 00028 static bool gKeyRealtimeInitialized = jack_tls_allocate_key(&JackGlobals::fRealTime); 00029 00030 jack_tls_key JackGlobals::fKeyLogFunction; 00031 static bool fKeyLogFunctionInitialized = jack_tls_allocate_key(&JackGlobals::fKeyLogFunction); 00032 00033 JackMutex* JackGlobals::fOpenMutex = new JackMutex(); 00034 bool JackGlobals::fServerRunning = false; 00035 JackClient* JackGlobals::fClientTable[CLIENT_NUM] = {}; 00036 00037 #ifndef WIN32 00038 jack_thread_creator_t JackGlobals::fJackThreadCreator = pthread_create; 00039 #endif 00040 00041 #ifdef __CLIENTDEBUG__ 00042 std::ofstream* JackGlobals::fStream = NULL; 00043 00044 void JackGlobals::CheckContext(const char* name) 00045 { 00046 if (JackGlobals::fStream == NULL) { 00047 char provstr[256]; 00048 char buffer[256]; 00049 time_t curtime; 00050 struct tm *loctime; 00051 /* Get the current time. */ 00052 curtime = time (NULL); 00053 /* Convert it to local time representation. */ 00054 loctime = localtime (&curtime); 00055 strftime (buffer, 256, "%I-%M", loctime); 00056 sprintf(provstr, "JackAPICall-%s.log", buffer); 00057 JackGlobals::fStream = new std::ofstream(provstr, std::ios_base::ate); 00058 JackGlobals::fStream->is_open(); 00059 } 00060 (*fStream) << "JACK API call : " << name << ", calling thread : " << pthread_self() << std::endl; 00061 } 00062 #endif 00063 00064 } // end of namespace