First batch of change of waf/MSVC specific changes from EZ4Stephen

This commit is contained in:
Robin Gareus 2025-11-09 20:14:32 +01:00
parent e29523ab52
commit 4998b114ea
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
7 changed files with 24 additions and 9 deletions

View file

@ -15,6 +15,9 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef COMPILER_MSVC
#define _USE_MATH_DEFINES
#endif
#include <math.h>

View file

@ -21,7 +21,10 @@
#include <cerrno>
#include <cstring>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef PLATFORM_WINDOWS
#include <winsock2.h>

View file

@ -29,7 +29,7 @@
#define PTHREAD_MACROS_DEFINED
#ifdef PTW32_VERSION /* pthread_win32 */
#define mark_pthread_inactive(threadID) threadID.p=0
#define is_pthread_active(threadID) threadID.p!=0
#define is_pthread_active(threadID) (threadID.p!=0)
#else /* normal pthread */
#define mark_pthread_inactive(threadID) threadID=0
#define is_pthread_active(threadID) threadID!=0

View file

@ -18,7 +18,9 @@
#pragma once
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
namespace PBD {

View file

@ -194,7 +194,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 ())) {
if (pthread_equal (t.first, pthread_self ()) != 0) {
DEBUG_TRACE (PBD::DEBUG::Threads, string_compose ("Terminated: '%1'\n", t.second));
all_threads.erase (t.first);
break;
@ -262,7 +262,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 ())) {
if (pthread_equal (t.first, pthread_self ()) != 0) {
continue;
}
DEBUG_TRACE (PBD::DEBUG::Threads, string_compose ("Kill: '%1'\n", t.second));
@ -277,7 +277,7 @@ pthread_cancel_all ()
{
pthread_mutex_lock (&thread_map_lock);
for (auto const& t : all_threads) {
if (pthread_equal (t.first, pthread_self ())) {
if (pthread_equal (t.first, pthread_self ()) != 0) {
continue;
}
DEBUG_TRACE (PBD::DEBUG::Threads, string_compose ("Cancel: '%1'\n", t.second));
@ -292,7 +292,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)) {
if (pthread_equal (t.first, thread) != 0) {
all_threads.erase (t.first);
break;
}
@ -443,7 +443,7 @@ pbd_set_thread_priority (pthread_t thread, int policy, int priority)
DEBUG_TRACE (PBD::DEBUG::Threads, string_compose ("Change '%1' to policy = %2 priority = %3\n", pthread_name(), policy, param.sched_priority));
#ifdef PLATFORM_WINDOWS
if (is_pthread_active (thread) && param.sched_priority >= 12) {
if (thread.p != 0 && param.sched_priority >= 12) {
if (set_win_set_realtime_policy (thread, param.sched_priority)) {
return 0;
}
@ -588,7 +588,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 ())) {
if (pthread_equal (t.first, pthread_self ()) != 0) {
DEBUG_TRACE (PBD::DEBUG::Threads, string_compose ("Terminated: '%1'\n", t.second));
all_threads.erase (t.first);
break;

View file

@ -18,14 +18,17 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <algorithm>
#include <assert.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifndef COMPILER_MSVC
#include <dirent.h>

View file

@ -23,6 +23,10 @@
#include "pbd/windows_special_dirs.h"
#if defined (COMPILER_MSVC) && !defined (PATH_MAX)
#define PATH_MAX _MAX_PATH
#endif
std::string
PBD::get_win_special_folder_path (int csidl)
{