JackGlobals.cpp 2.09 KB
Newer Older
sletz's avatar
sletz committed
1
/*
sletz's avatar
sletz committed
2
Copyright (C) 2004-2008 Grame
sletz's avatar
sletz committed
3
4

This program is free software; you can redistribute it and/or modify
5
6
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
sletz's avatar
sletz committed
7
8
9
10
11
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
GNU Lesser General Public License for more details.
sletz's avatar
sletz committed
13

14
You should have received a copy of the GNU Lesser General Public License
sletz's avatar
sletz committed
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
sletz's avatar
sletz committed
17
18
19
20
21

*/

#include "JackGlobals.h"

22
23
namespace Jack
{
sletz's avatar
Cleanup    
sletz committed
24

25
bool JackGlobals::fVerbose = 0;
sletz's avatar
sletz committed
26

27
28
jack_tls_key JackGlobals::fRealTime;
static bool gKeyRealtimeInitialized = jack_tls_allocate_key(&JackGlobals::fRealTime);
29

30
31
32
33
jack_tls_key JackGlobals::fKeyLogFunction;
static bool fKeyLogFunctionInitialized = jack_tls_allocate_key(&JackGlobals::fKeyLogFunction);

JackMutex* JackGlobals::fOpenMutex = new JackMutex();
34
volatile bool JackGlobals::fServerRunning = false;
35
36
JackClient* JackGlobals::fClientTable[CLIENT_NUM] = {};

sletz's avatar
sletz committed
37
38
39
#ifndef WIN32
jack_thread_creator_t JackGlobals::fJackThreadCreator = pthread_create;
#endif
sletz's avatar
sletz committed
40

sletz's avatar
sletz committed
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifdef __CLIENTDEBUG__
std::ofstream* JackGlobals::fStream = NULL;

void JackGlobals::CheckContext(const char* name)
{
    if (JackGlobals::fStream == NULL) {
        char provstr[256];
        char buffer[256];
        time_t curtime;
        struct tm *loctime;
        /* Get the current time. */
        curtime = time (NULL);
        /* Convert it to local time representation. */
        loctime = localtime (&curtime);
sletz's avatar
sletz committed
55
        strftime(buffer, 256, "%I-%M", loctime);
56
        snprintf(provstr, sizeof(provstr), "JackAPICall-%s.log", buffer);
sletz's avatar
sletz committed
57
58
59
60
61
        JackGlobals::fStream = new std::ofstream(provstr, std::ios_base::ate);
        JackGlobals::fStream->is_open();
    }
    (*fStream) << "JACK API call : " << name << ", calling thread : " << pthread_self() << std::endl;
}
sletz's avatar
sletz committed
62
#endif
63

nedko's avatar
nedko committed
64
} // end of namespace