diff options
author | sletz <sletz@0c269be4-1314-0410-8aa9-9f06e86f4224> | 2008-09-20 10:50:40 +0000 |
---|---|---|
committer | sletz <sletz@0c269be4-1314-0410-8aa9-9f06e86f4224> | 2008-09-20 10:50:40 +0000 |
commit | 183b591a9bac28bd031c6a04f4c9f8f18725d955 (patch) | |
tree | a6fbc118c083bf4443a6ea48d75ad0c19812cc99 | |
parent | 4806e5e7a70a510b1d65b9e2a299ebfc1cda402b (diff) | |
download | jack2-183b591a9bac28bd031c6a04f4c9f8f18725d955.tar.gz |
Michael Voigt JackAPI cleanup patch.
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2934 0c269be4-1314-0410-8aa9-9f06e86f4224
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | common/JackAPI.cpp | 45 | ||||
-rw-r--r-- | common/JackLibAPI.cpp | 20 | ||||
-rw-r--r-- | common/JackServerAPI.cpp | 16 | ||||
-rw-r--r-- | common/JackThread.h | 1 | ||||
-rw-r--r-- | common/varargs.h | 1 | ||||
-rw-r--r-- | common/wscript | 3 | ||||
-rw-r--r-- | macosx/JackMachThread.h | 8 | ||||
-rw-r--r-- | posix/JackPosixServerLaunch.cpp (renamed from common/JackServerLaunch.cpp) | 0 | ||||
-rw-r--r-- | posix/JackPosixThread.h | 2 | ||||
-rw-r--r-- | posix/JackSystemDeps_os.h | 2 | ||||
-rw-r--r-- | windows/JackSystemDeps_os.h | 3 | ||||
-rw-r--r-- | windows/JackWinThread.h | 8 |
13 files changed, 50 insertions, 65 deletions
@@ -23,9 +23,13 @@ Michael Voigt Jackdmp changes log --------------------------- +2008-08-20 Stephane Letz <letz@grame.fr> + + * Michael Voigt JackAPI cleanup patch. + 2008-08-19 Stephane Letz <letz@grame.fr> - * Michael Voigt JackTime patch. + * Michael Voigt JackTime cleanup patch. 2008-09-17 Stephane Letz <letz@grame.fr> diff --git a/common/JackAPI.cpp b/common/JackAPI.cpp index b651d897..30255303 100644 --- a/common/JackAPI.cpp +++ b/common/JackAPI.cpp @@ -31,14 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "JackTime.h" #include "JackCompilerDeps.h" #include "JackPortType.h" - -#ifdef __APPLE__ -#include "JackMachThread.h" -#elif WIN32 -#include "JackWinThread.h" -#else -#include "JackPosixThread.h" -#endif +#include "JackPlatformPlug.h" #include <math.h> #ifdef __CLIENTDEBUG__ @@ -1588,14 +1581,8 @@ EXPORT void jack_reset_max_delayed_usecs(jack_client_t* ext_client) // thread.h EXPORT int jack_acquire_real_time_scheduling(pthread_t thread, int priority) { -#ifdef __APPLE__ JackEngineControl* control = GetEngineControl(); - return (control ? JackMachThread::AcquireRealTimeImp(thread, GetEngineControl()->fPeriod, GetEngineControl()->fComputation, GetEngineControl()->fConstraint) : -1); -#elif WIN32 - return JackWinThread::AcquireRealTimeImp(thread, priority); -#else - return JackPosixThread::AcquireRealTimeImp(thread, priority); -#endif + return (control ? JackThread::AcquireRealTimeImp(thread, priority, GetEngineControl()->fPeriod, GetEngineControl()->fComputation, GetEngineControl()->fConstraint) : -1); } EXPORT int jack_client_create_thread(jack_client_t* client, @@ -1605,42 +1592,22 @@ EXPORT int jack_client_create_thread(jack_client_t* client, void *(*start_routine)(void*), void *arg) { -#ifdef __APPLE__ - return JackPosixThread::StartImp(thread, priority, realtime, start_routine, arg); -#elif WIN32 - return JackWinThread::StartImp(thread, priority, realtime, (ThreadCallback)start_routine, arg); -#else - return JackPosixThread::StartImp(thread, priority, realtime, start_routine, arg); -#endif + return JackThread::StartImp(thread, priority, realtime, start_routine, arg); } EXPORT int jack_drop_real_time_scheduling(pthread_t thread) { -#ifdef __APPLE__ - return JackMachThread::DropRealTimeImp(thread); -#elif WIN32 - return JackWinThread::DropRealTimeImp(thread); -#else - return JackPosixThread::DropRealTimeImp(thread); -#endif + return JackThread::DropRealTimeImp(thread); } EXPORT int jack_client_stop_thread(jack_client_t* client, pthread_t thread) { -#ifdef WIN32 - return JackWinThread::StopImp(thread); -#else - return JackPosixThread::StopImp(thread); -#endif + return JackThread::StopImp(thread); } EXPORT int jack_client_kill_thread(jack_client_t* client, pthread_t thread) { -#ifdef WIN32 - return JackWinThread::KillImp(thread); -#else - return JackPosixThread::KillImp(thread); -#endif + return JackThread::KillImp(thread); } // intclient.h diff --git a/common/JackLibAPI.cpp b/common/JackLibAPI.cpp index d22a0834..ed5c808c 100644 --- a/common/JackLibAPI.cpp +++ b/common/JackLibAPI.cpp @@ -27,9 +27,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "JackChannel.h" #include "JackLibGlobals.h" #include "JackGlobals.h" -#include "JackServerLaunch.h" #include "JackCompilerDeps.h" #include "JackTools.h" +#include "JackSystemDeps.h" +#include "JackServerLaunch.h" using namespace Jack; @@ -81,30 +82,25 @@ EXPORT jack_client_t* jack_client_open_aux(const char* ext_client_name, jack_opt } /* parse variable arguments */ - if (ap) + if (ap) { jack_varargs_parse(options, ap, &va); - else + } else { jack_varargs_init(&va); + } JackLibGlobals::Init(); // jack library initialisation -#ifndef WIN32 if (try_start_server(&va, options, status)) { jack_error("jack server is not running or cannot be started"); JackLibGlobals::Destroy(); // jack library destruction return 0; } -#endif -#ifndef WIN32 - char* jack_debug = getenv("JACK_CLIENT_DEBUG"); - if (jack_debug && strcmp(jack_debug, "on") == 0) + if (JACK_DEBUG) { client = new JackDebugClient(new JackLibClient(GetSynchroTable())); // Debug mode - else + } else { client = new JackLibClient(GetSynchroTable()); -#else - client = new JackLibClient(GetSynchroTable()); -#endif + } int res = client->Open(va.server_name, client_name, options, status); if (res < 0) { diff --git a/common/JackServerAPI.cpp b/common/JackServerAPI.cpp index 7021f0fe..b2f47819 100644 --- a/common/JackServerAPI.cpp +++ b/common/JackServerAPI.cpp @@ -28,7 +28,6 @@ This program is free software; you can redistribute it and/or modify #include "JackServer.h" #include "JackDebugClient.h" #include "JackServerGlobals.h" -#include "JackServerLaunch.h" #include "JackTools.h" #include "JackCompilerDeps.h" #include "JackLockedEngine.h" @@ -83,10 +82,11 @@ EXPORT jack_client_t* jack_client_open_aux(const char* ext_client_name, jack_opt } /* parse variable arguments */ - if (ap) + if (ap) { jack_varargs_parse(options, ap, &va); - else + } else { jack_varargs_init(&va); + } g_nostart = (options & JackNoStartServer) != 0; if (!g_nostart) { @@ -97,15 +97,11 @@ EXPORT jack_client_t* jack_client_open_aux(const char* ext_client_name, jack_opt } } -#ifndef WIN32 - char* jack_debug = getenv("JACK_CLIENT_DEBUG"); - if (jack_debug && strcmp(jack_debug, "on") == 0) + if (JACK_DEBUG) { client = new JackDebugClient(new JackInternalClient(JackServer::fInstance, GetSynchroTable())); // Debug mode - else + } else { client = new JackInternalClient(JackServer::fInstance, GetSynchroTable()); -#else - client = new JackInternalClient(JackServer::fInstance, GetSynchroTable()); -#endif + } int res = client->Open(va.server_name, client_name, options, status); if (res < 0) { diff --git a/common/JackThread.h b/common/JackThread.h index 4e651835..75379aa8 100644 --- a/common/JackThread.h +++ b/common/JackThread.h @@ -103,6 +103,7 @@ class SERVER_EXPORT JackThreadInterface pthread_t GetThreadID(); static int AcquireRealTimeImp(pthread_t thread, int priority); + static int AcquireRealTimeImp(pthread_t thread, int priority, UInt64 period, UInt64 computation, UInt64 constraint); static int DropRealTimeImp(pthread_t thread); static int StartImp(pthread_t* thread, int priority, int realtime, void*(*start_routine)(void*), void* arg); static int StopImp(pthread_t thread); diff --git a/common/varargs.h b/common/varargs.h index af70a36c..d1442fd3 100644 --- a/common/varargs.h +++ b/common/varargs.h @@ -23,6 +23,7 @@ #include <stdlib.h> #include <stdarg.h> #include <string.h> +#include "types.h" #ifdef __cplusplus extern "C" diff --git a/common/wscript b/common/wscript index 8b681c68..6a87a338 100644 --- a/common/wscript +++ b/common/wscript @@ -180,12 +180,12 @@ def build(bld): clientlib.source += [ 'JackLibClient.cpp', 'JackLibAPI.cpp', - 'JackServerLaunch.cpp', ] if bld.env()['IS_LINUX']: clientlib.source += [ '../posix/JackSocketClientChannel.cpp', + '../posix/JackPosixServerLaunch.cpp', ] if bld.env()['IS_MACOSX']: @@ -193,6 +193,7 @@ def build(bld): '../macosx/JackMachClientChannel.cpp', '../macosx/RPC/JackRPCEngineUser.c', '../macosx/JackMacLibClientRPC.cpp', + '../posix/JackPosixServerLaunch.cpp', ] clientlib.vnum = bld.env()['JACK_API_VERSION'] diff --git a/macosx/JackMachThread.h b/macosx/JackMachThread.h index 398a7f16..4e17959b 100644 --- a/macosx/JackMachThread.h +++ b/macosx/JackMachThread.h @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* - Copyright: © Copyright 2002 Apple Computer, Inc. All rights reserved. + Copyright: Copyright 2002 Apple Computer, Inc. All rights reserved. Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in consideration of your agreement to the following terms, and your @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. please do not use, install, modify or redistribute this Apple software. In consideration of your agreement to abide by the following terms, and subject - to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs + to these terms, Apple grants you a personal, non-exclusive license, under Apple copyrights in this original Apple software (the "Apple Software"), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute @@ -111,6 +111,10 @@ class SERVER_EXPORT JackMachThread : public JackPosixThread static int SetThreadToPriority(pthread_t thread, UInt32 inPriority, Boolean inIsFixed, UInt64 period, UInt64 computation, UInt64 constraint); static int AcquireRealTimeImp(pthread_t thread, UInt64 period, UInt64 computation, UInt64 constraint); + static int AcquireRealTimeImp(pthread_t thread, int priority, UInt64 period, UInt64 computation, UInt64 constraint) + { + return JackMachThread::AcquireRealTimeImp(thread, period, computation, constraint); + } static int DropRealTimeImp(pthread_t thread); }; diff --git a/common/JackServerLaunch.cpp b/posix/JackPosixServerLaunch.cpp index 11a95a61..11a95a61 100644 --- a/common/JackServerLaunch.cpp +++ b/posix/JackPosixServerLaunch.cpp diff --git a/posix/JackPosixThread.h b/posix/JackPosixThread.h index 828a5e78..a0cec26a 100644 --- a/posix/JackPosixThread.h +++ b/posix/JackPosixThread.h @@ -65,6 +65,8 @@ class SERVER_EXPORT JackPosixThread : public detail::JackThreadInterface pthread_t GetThreadID(); static int AcquireRealTimeImp(pthread_t thread, int priority); + static int AcquireRealTimeImp(pthread_t thread, int priority, UInt64 period, UInt64 computation, UInt64 constraint) + { return JackPosixThread::AcquireRealTimeImp(thread, priority); } static int DropRealTimeImp(pthread_t thread); static int StartImp(pthread_t* thread, int priority, int realtime, void*(*start_routine)(void*), void* arg); static int StopImp(pthread_t thread); diff --git a/posix/JackSystemDeps_os.h b/posix/JackSystemDeps_os.h index 7853e92a..dae9f6fd 100644 --- a/posix/JackSystemDeps_os.h +++ b/posix/JackSystemDeps_os.h @@ -30,4 +30,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #define UnloadDriverModule(handle) dlclose((handle)) #define GetProc(handle, name) dlsym((handle), (name)) +#define JACK_DEBUG (getenv("JACK_CLIENT_DEBUG") && strcmp(getenv("JACK_CLIENT_DEBUG"), "on") == 0) + #endif diff --git a/windows/JackSystemDeps_os.h b/windows/JackSystemDeps_os.h index 77daf14f..93f586c8 100644 --- a/windows/JackSystemDeps_os.h +++ b/windows/JackSystemDeps_os.h @@ -31,5 +31,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #define ENOBUFS 55 +#define JACK_DEBUG false +#define try_start_server 0 + #endif diff --git a/windows/JackWinThread.h b/windows/JackWinThread.h index 4c904aea..11ab8af5 100644 --- a/windows/JackWinThread.h +++ b/windows/JackWinThread.h @@ -64,7 +64,15 @@ class SERVER_EXPORT JackWinThread : public detail::JackThreadInterface pthread_t GetThreadID(); static int AcquireRealTimeImp(pthread_t thread, int priority); + static int AcquireRealTimeImp(pthread_t thread, int priority, UInt64 period, UInt64 computation, UInt64 constraint) + { + return JackWinThread::AcquireRealTimeImp(thread, priority); + } static int DropRealTimeImp(pthread_t thread); + static int StartImp(pthread_t* thread, int priority, int realtime, void*(*start_routine)(void*), void* arg) + { + return JackWinThread::StartImp(thread, priority, realtime, (ThreadCallback) start_routine, arg); + } static int StartImp(pthread_t* thread, int priority, int realtime, ThreadCallback start_routine, void* arg); static int StopImp(pthread_t thread); static int KillImp(pthread_t thread); |