Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
falkTX committed Apr 14, 2021
2 parents e984aeb + 852ba2b commit 5041ab0
Show file tree
Hide file tree
Showing 19 changed files with 2,136 additions and 13 deletions.
8 changes: 8 additions & 0 deletions ChangeLog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
ChangeLog
#########

* 1.9.18 (2021-04-15)

* Add zalsa_in/out as internal client (based on zita-a2j/j2a and jack1 code)
* Fix jack_midi_dump deadlock on close after the jack server is restarted
* Fix interrupt signal for linux futex waits
* Fix usage of meta-data in official macOS builds (private DB errors)
* Log error message when cleaning previous DB (macOS and Windows)

* 1.9.17 (2021-01-15)

* Fix jack_control stopping after first command iteration
Expand Down
3 changes: 2 additions & 1 deletion common/JackClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <math.h>
#include <string>
#include <algorithm>
#include <climits>

using namespace std;

Expand Down Expand Up @@ -636,7 +637,7 @@ inline int JackClient::CallProcessCallback()
inline bool JackClient::WaitSync()
{
// Suspend itself: wait on the input synchro
if (GetGraphManager()->SuspendRefNum(GetClientControl(), fSynchroTable, 0x7FFFFFFF) < 0) {
if (GetGraphManager()->SuspendRefNum(GetClientControl(), fSynchroTable, LONG_MAX) < 0) {
jack_error("SuspendRefNum error");
return false;
} else {
Expand Down
2 changes: 1 addition & 1 deletion common/JackConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "config.h"
#endif

#define VERSION "1.9.17"
#define VERSION "1.9.18"

#define BUFFER_SIZE_MAX 8192

Expand Down
6 changes: 4 additions & 2 deletions common/JackMetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,11 @@ int JackMetadata::PropertyInit()
#endif

if ((ret = fDBenv->open (fDBenv, dbpath, DB_CREATE | DB_INIT_LOCK | DB_INIT_MPOOL | DB_THREAD, 0)) != 0) {
#ifdef WIN32
#if defined(WIN32) || defined(__APPLE__)
// new versions of jack2 are built with HAVE_MIXED_SIZE_ADDRESSING, which induces this error, this is expected
if (ret == DB_VERSION_MISMATCH) {
jack_error ("Failed to open previous DB environment, trying again clean...");

// cleanup old stuff
snprintf (dbpath, sizeof(dbpath), "%s/jack_db/metadata.db", fDBFilesDir);
remove (dbpath);
Expand All @@ -145,7 +147,7 @@ int JackMetadata::PropertyInit()
if (ret != 0)
#endif
{
jack_error ("cannot open DB environment: %s", db_strerror (ret));
jack_error ("Cannot open DB environment: %s", db_strerror (ret));
fDBenv = NULL;
return -1;
}
Expand Down
17 changes: 13 additions & 4 deletions linux/JackLinuxFutex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "JackConstants.h"
#include "JackError.h"
#include "promiscuous.h"
#include <climits>
#include <fcntl.h>
#include <stdio.h>
#include <sys/mman.h>
Expand Down Expand Up @@ -93,18 +94,24 @@ bool JackLinuxFutex::Wait()
fFutex->internal = !fFutex->internal;
}

const int wait_mode = fFutex->internal ? FUTEX_WAIT_PRIVATE : FUTEX_WAIT;

for (;;)
{
if (__sync_bool_compare_and_swap(&fFutex->futex, 1, 0))
return true;

if (::syscall(SYS_futex, fFutex, fFutex->internal ? FUTEX_WAIT_PRIVATE : FUTEX_WAIT, 0, NULL, NULL, 0) != 0 && errno != EWOULDBLOCK)
return false;
if (::syscall(SYS_futex, fFutex, wait_mode, 0, NULL, NULL, 0) != 0)
if (errno != EAGAIN && errno != EINTR)
return false;
}
}

bool JackLinuxFutex::TimedWait(long usec)
{
if (usec == LONG_MAX)
return Wait();

if (!fFutex) {
jack_error("JackLinuxFutex::TimedWait name = %s already deallocated!!", fName);
return false;
Expand All @@ -120,14 +127,16 @@ bool JackLinuxFutex::TimedWait(long usec)
const int nsecs = (usec % 1000000) * 1000;

const timespec timeout = { static_cast<time_t>(secs), nsecs };
const int wait_mode = fFutex->internal ? FUTEX_WAIT_PRIVATE : FUTEX_WAIT;

for (;;)
{
if (__sync_bool_compare_and_swap(&fFutex->futex, 1, 0))
return true;

if (::syscall(SYS_futex, fFutex, fFutex->internal ? FUTEX_WAIT_PRIVATE : FUTEX_WAIT, 0, &timeout, NULL, 0) != 0 && errno != EWOULDBLOCK)
return false;
if (::syscall(SYS_futex, fFutex, wait_mode, 0, &timeout, NULL, 0) != 0)
if (errno != EAGAIN && errno != EINTR)
return false;
}
}

Expand Down
5 changes: 5 additions & 0 deletions tools/midi_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ process (jack_nframes_t frames, void* arg)
static void wearedone(int sig) {
fprintf(stderr, "Shutting down\n");
keeprunning = 0;
/* main loop might be blocked by data_ready when jack server dies. */
if (pthread_mutex_trylock (&msg_thread_lock) == 0) {
pthread_cond_signal (&data_ready);
pthread_mutex_unlock (&msg_thread_lock);
}
}

static void usage (int status) {
Expand Down
28 changes: 24 additions & 4 deletions tools/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ example_tools = {
}

def configure(conf):
conf.env['BUILD_EXAMPLE_ALSA_IO'] = conf.env['SAMPLERATE'] and conf.env['BUILD_DRIVER_ALSA']
conf.env['BUILD_EXAMPLE_CLIENT_TRANSPORT'] = conf.env['READLINE']
conf.env['BUILD_TOOL_ALSA_IO'] = conf.env['SAMPLERATE'] and conf.env['BUILD_DRIVER_ALSA']
conf.env['BUILD_TOOL_CLIENT_TRANSPORT'] = conf.env['READLINE']
conf.env['BUILD_TOOL_ZALSA'] = conf.env['ZALSA']

def build(bld):
if bld.env['IS_LINUX']:
Expand Down Expand Up @@ -50,7 +51,7 @@ def build(bld):

prog.target = example_tool

if bld.env['BUILD_EXAMPLE_CLIENT_TRANSPORT']:
if bld.env['BUILD_TOOL_CLIENT_TRANSPORT']:
prog = bld(features = 'c cprogram')
prog.includes = os_incdir + ['../common/jack', '../common']
prog.source = 'transport.c'
Expand All @@ -74,7 +75,7 @@ def build(bld):
prog.target = 'jack_netsource'
prog.defines = ['HAVE_CONFIG_H']

if bld.env['IS_LINUX'] and bld.env['BUILD_EXAMPLE_ALSA_IO']:
if bld.env['IS_LINUX'] and bld.env['BUILD_TOOL_ALSA_IO']:
prog = bld(features = 'c cprogram')
prog.includes = os_incdir + ['../common/jack', '../common']
prog.source = ['alsa_in.c', '../common/memops.c']
Expand All @@ -89,6 +90,25 @@ def build(bld):
prog.use = ['clientlib', 'ALSA', 'SAMPLERATE', 'M']
prog.target = 'alsa_out'

if bld.env['IS_LINUX'] and bld.env['BUILD_TOOL_ZALSA']:
prog = bld(features = ['cxx', 'cxxshlib'])
prog.defines = ['HAVE_CONFIG_H','SERVER_SIDE','APPNAME="zalsa_in"','VERSION="0.4.0"']
prog.install_path = '${ADDON_DIR}/'
prog.includes = os_incdir + ['../common/jack', '../common', 'zalsa']
prog.source = ['zalsa/zita-a2j.cc', 'zalsa/alsathread.cc', 'zalsa/jackclient.cc', 'zalsa/pxthread.cc', 'zalsa/lfqueue.cc']
prog.target = 'zalsa_in'
prog.use = ['ZITA-ALSA-PCMI', 'ZITA-RESAMPLER', 'ALSA', 'M', 'RT', 'serverlib']
prog.env['cxxshlib_PATTERN'] = '%s.so'

prog = bld(features = ['cxx', 'cxxshlib'])
prog.defines = ['HAVE_CONFIG_H','SERVER_SIDE','APPNAME="zalsa_out"','VERSION="0.4.0"']
prog.install_path = '${ADDON_DIR}/'
prog.includes = os_incdir + ['../common/jack', '../common', 'zalsa']
prog.source = ['zalsa/zita-j2a.cc', 'zalsa/alsathread.cc', 'zalsa/jackclient.cc', 'zalsa/pxthread.cc', 'zalsa/lfqueue.cc']
prog.target = 'zalsa_out'
prog.use = ['ZITA-ALSA-PCMI', 'ZITA-RESAMPLER', 'ALSA', 'M', 'RT', 'serverlib']
prog.env['cxxshlib_PATTERN'] = '%s.so'

if not bld.env['IS_WINDOWS']:
bld.symlink_as('${PREFIX}/bin/jack_disconnect', 'jack_connect')
bld.install_files('${PREFIX}/bin', 'jack_control', chmod=0o755)

0 comments on commit 5041ab0

Please sign in to comment.