Browse Source

Michael Voigt JackAPI cleanup patch.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2934 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.90
sletz 16 years ago
parent
commit
183b591a9b
13 changed files with 50 additions and 65 deletions
  1. +5
    -1
      ChangeLog
  2. +6
    -39
      common/JackAPI.cpp
  3. +8
    -12
      common/JackLibAPI.cpp
  4. +6
    -10
      common/JackServerAPI.cpp
  5. +1
    -0
      common/JackThread.h
  6. +1
    -0
      common/varargs.h
  7. +2
    -1
      common/wscript
  8. +6
    -2
      macosx/JackMachThread.h
  9. +0
    -0
      posix/JackPosixServerLaunch.cpp
  10. +2
    -0
      posix/JackPosixThread.h
  11. +2
    -0
      posix/JackSystemDeps_os.h
  12. +3
    -0
      windows/JackSystemDeps_os.h
  13. +8
    -0
      windows/JackWinThread.h

+ 5
- 1
ChangeLog View File

@@ -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>


+ 6
- 39
common/JackAPI.cpp View File

@@ -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


+ 8
- 12
common/JackLibAPI.cpp View File

@@ -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) {


+ 6
- 10
common/JackServerAPI.cpp View File

@@ -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) {


+ 1
- 0
common/JackThread.h View File

@@ -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);


+ 1
- 0
common/varargs.h View File

@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "types.h"

#ifdef __cplusplus
extern "C"


+ 2
- 1
common/wscript View File

@@ -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']


+ 6
- 2
macosx/JackMachThread.h View File

@@ -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);
};



common/JackServerLaunch.cpp → posix/JackPosixServerLaunch.cpp View File


+ 2
- 0
posix/JackPosixThread.h View File

@@ -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);


+ 2
- 0
posix/JackSystemDeps_os.h View File

@@ -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

+ 3
- 0
windows/JackSystemDeps_os.h View File

@@ -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


+ 8
- 0
windows/JackWinThread.h View File

@@ -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);


Loading…
Cancel
Save