mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
Merge ffbe87961e into 0f3760a8d1
This commit is contained in:
commit
94943d6609
8 changed files with 36 additions and 17 deletions
|
|
@ -36,7 +36,11 @@
|
|||
#include "pbd/cpus.h"
|
||||
|
||||
#if defined(COMPILER_MSVC) && !defined(PTW32_VERSION)
|
||||
#ifndef OTHER1
|
||||
#include <ardourext/pthread.h> // Gets us 'PTW32_VERSION'
|
||||
#else
|
||||
#include <pthread.h> //Gets us '__PTW32_VERSION'
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int32_t
|
||||
|
|
@ -69,7 +73,7 @@ PBD::hardware_concurrency()
|
|||
return c;
|
||||
}
|
||||
}
|
||||
#if defined(PTW32_VERSION) || defined(__hpux)
|
||||
#if defined(PTW32_VERSION) || defined(__hpux) || defined(__PTW32_VERSION)
|
||||
return pthread_num_processors_np();
|
||||
#elif defined(__APPLE__)
|
||||
int count;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,10 @@
|
|||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef COMPILER_MSVC
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#include <glib.h>
|
||||
#include "pbd/gstdio_compat.h"
|
||||
#include <glibmm.h>
|
||||
|
|
|
|||
|
|
@ -59,8 +59,9 @@
|
|||
/* close(), read(), write() */
|
||||
#ifdef COMPILER_MSVC
|
||||
#include <io.h> // Microsoft's nearest equivalent to <unistd.h>
|
||||
#ifndef OTHER1
|
||||
#include <ardourext/misc.h>
|
||||
#else
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "pbd/compose.h"
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include "pbd/i18n.h"
|
||||
|
||||
#ifdef COMPILER_MSVC
|
||||
#if defined(COMPILER_MSVC) && !defined(OTHER1)
|
||||
#include <ardourext/misc.h> // Needed for 'DECLARE_DEFAULT_COMPARISONS'. Objects in an STL container can be
|
||||
// searched and sorted. Thus, when instantiating the container, MSVC complains
|
||||
// if the type of object being contained has no appropriate comparison operators
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
#include "pbd/timing.h"
|
||||
|
||||
/* check for PTW32_VERSION */
|
||||
#ifdef COMPILER_MSVC
|
||||
#if defined(COMPILER_MSVC) && !defined(OTHER1)
|
||||
#include <ardourext/pthread.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#ifndef COMPILER_MSVC
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#elif !defined(OTHER1)
|
||||
#include <ardourext/misc.h>
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -38,11 +38,21 @@
|
|||
#include "pbd/pthread_utils.h"
|
||||
|
||||
#ifdef COMPILER_MSVC
|
||||
DECLARE_DEFAULT_COMPARISONS (pthread_t) // Needed for 'DECLARE_DEFAULT_COMPARISONS'. Objects in an STL container can be
|
||||
// searched and sorted. Thus, when instantiating the container, MSVC complains
|
||||
// if the type of object being contained has no appropriate comparison operators
|
||||
// defined (specifically, if operators '<' and '==' are undefined). This seems
|
||||
// to be the case with ptw32 'pthread_t' which is a simple struct.
|
||||
LIBPBD_API inline bool operator<(const pthread_t& lhs, const pthread_t& rhs) {
|
||||
return lhs.p != rhs.p ? lhs.p < rhs.p : lhs.x < rhs.x;
|
||||
}
|
||||
LIBPBD_API inline bool operator==(const pthread_t& lhs, const pthread_t& rhs) {
|
||||
return lhs.p == rhs.p && lhs.x == rhs.x;
|
||||
}
|
||||
LIBPBD_API inline bool operator!=(const pthread_t& lhs, const pthread_t& rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
LIBPBD_API inline bool operator==(const pthread_t& lhs, int rhs) {
|
||||
return !rhs && !lhs.p;
|
||||
}
|
||||
LIBPBD_API inline bool operator!=(const pthread_t& lhs, int rhs) {
|
||||
return rhs || lhs.p;
|
||||
}
|
||||
|
||||
#define pthread_gethandle pthread_getw32threadhandle_np
|
||||
#endif
|
||||
|
|
@ -194,7 +204,7 @@ fake_thread_start (void* arg)
|
|||
pthread_mutex_lock (&thread_map_lock);
|
||||
|
||||
for (auto const& t : all_threads) {
|
||||
if (pthread_equal (t.first, pthread_self ()) != 0) {
|
||||
if (pthread_equal (t.first, pthread_self ())) {
|
||||
DEBUG_TRACE (PBD::DEBUG::Threads, string_compose ("Terminated: '%1'\n", t.second));
|
||||
all_threads.erase (t.first);
|
||||
break;
|
||||
|
|
@ -262,7 +272,7 @@ pthread_kill_all (int signum)
|
|||
{
|
||||
pthread_mutex_lock (&thread_map_lock);
|
||||
for (auto const& t : all_threads) {
|
||||
if (pthread_equal (t.first, pthread_self ()) != 0) {
|
||||
if (pthread_equal (t.first, pthread_self ())) {
|
||||
continue;
|
||||
}
|
||||
DEBUG_TRACE (PBD::DEBUG::Threads, string_compose ("Kill: '%1'\n", t.second));
|
||||
|
|
@ -277,7 +287,7 @@ pthread_cancel_all ()
|
|||
{
|
||||
pthread_mutex_lock (&thread_map_lock);
|
||||
for (auto const& t : all_threads) {
|
||||
if (pthread_equal (t.first, pthread_self ()) != 0) {
|
||||
if (pthread_equal (t.first, pthread_self ())) {
|
||||
continue;
|
||||
}
|
||||
DEBUG_TRACE (PBD::DEBUG::Threads, string_compose ("Cancel: '%1'\n", t.second));
|
||||
|
|
@ -292,7 +302,7 @@ pthread_cancel_one (pthread_t thread)
|
|||
{
|
||||
pthread_mutex_lock (&thread_map_lock);
|
||||
for (auto const& t : all_threads) {
|
||||
if (pthread_equal (t.first, thread) != 0) {
|
||||
if (pthread_equal (t.first, thread)) {
|
||||
all_threads.erase (t.first);
|
||||
break;
|
||||
}
|
||||
|
|
@ -588,7 +598,7 @@ PBD::Thread::_run (void* arg)
|
|||
/* cleanup */
|
||||
pthread_mutex_lock (&thread_map_lock);
|
||||
for (auto const& t : all_threads) {
|
||||
if (pthread_equal (t.first, pthread_self ()) != 0) {
|
||||
if (pthread_equal (t.first, pthread_self ())) {
|
||||
DEBUG_TRACE (PBD::DEBUG::Threads, string_compose ("Terminated: '%1'\n", t.second));
|
||||
all_threads.erase (t.first);
|
||||
break;
|
||||
|
|
@ -611,5 +621,5 @@ PBD::Thread::join ()
|
|||
bool
|
||||
PBD::Thread::caller_is_self () const
|
||||
{
|
||||
return pthread_equal (_t, pthread_self ()) != 0;
|
||||
return pthread_equal (_t, pthread_self ());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -492,7 +492,7 @@ SystemExec::start (StdErrMode stderr_mode, const char * /*vfork_exec_wrapper*/)
|
|||
stdinP[0], stdoutP[1], stderrP[1]
|
||||
};
|
||||
|
||||
success = CreateProcess(0, w_args,
|
||||
success = CreateProcessA(0, w_args,
|
||||
0, 0, /* bInheritHandles = */ TRUE,
|
||||
(CREATE_NO_WINDOW&0) | CREATE_UNICODE_ENVIRONMENT | (0&CREATE_NEW_CONSOLE),
|
||||
/*env = */ 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue