Browse Source

Fix CarlaThread for PT_W32, other fixes

tags/1.9.4
falkTX 13 years ago
parent
commit
646a0f8985
5 changed files with 25 additions and 11 deletions
  1. +0
    -1
      source/libs/distrho-plugin-toolkit/DistrhoUIOpenGLExt.h
  2. +0
    -1
      source/libs/pugl/pugl_win.cpp
  3. +9
    -3
      source/tests/Makefile
  4. +15
    -5
      source/utils/carla_utils.hpp
  5. +1
    -1
      source/utils/rt_list.hpp

+ 0
- 1
source/libs/distrho-plugin-toolkit/DistrhoUIOpenGLExt.h View File

@@ -22,7 +22,6 @@
#ifdef DISTRHO_UI_OPENGL #ifdef DISTRHO_UI_OPENGL


#include "DistrhoUIOpenGL.h" #include "DistrhoUIOpenGL.h"
#include <GL/gl.h>


START_NAMESPACE_DISTRHO START_NAMESPACE_DISTRHO




+ 0
- 1
source/libs/pugl/pugl_win.cpp View File

@@ -110,7 +110,6 @@ puglCreate(PuglNativeWindow parent,


// unused // unused
(void)resizable; (void)resizable;
(void)addToDesktop;
(void)x11Display; (void)x11Display;
} }




+ 9
- 3
source/tests/Makefile View File

@@ -9,10 +9,11 @@ include ../Makefile.mk
# -------------------------------------------------------------- # --------------------------------------------------------------


BUILD_CXX_FLAGS += -I../backend -I../includes -I../utils BUILD_CXX_FLAGS += -I../backend -I../includes -I../utils
# BUILD_CXX_FLAGS += -I/opt/mingw32/include
BUILD_CXX_FLAGS += $(shell pkg-config --cflags QtCore) BUILD_CXX_FLAGS += $(shell pkg-config --cflags QtCore)
LINK_FLAGS += $(shell pkg-config --libs QtCore) LINK_FLAGS += $(shell pkg-config --libs QtCore)


TARGETS = CarlaString RtList Thread
TARGETS = CarlaString RtList Thread GL_


all: $(TARGETS) RUN all: $(TARGETS) RUN


@@ -24,11 +25,16 @@ CarlaString: CarlaString.cpp
RtList: RtList.cpp ../libs/rtmempool.a RtList: RtList.cpp ../libs/rtmempool.a
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o $@ $(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o $@


Thread_: Thread.cpp
Thread: Thread.cpp
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -pthread -lpthread -o $@ $(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -pthread -lpthread -o $@


GL_: GL.cpp
# $(CXX) $^ $(BUILD_CXX_FLAGS) -I../backend/engine/plugin -I../libs/distrho-plugin-toolkit $(LINK_FLAGS) -lgdi32 -lopengl32 -lole32 -luuid -lws2_32 -o GL # $@
$(CXX) $^ $(BUILD_CXX_FLAGS) -I../backend/engine/plugin -I../libs/distrho-plugin-toolkit $(LINK_FLAGS) -lGL -lGLU -o GL # $@

RUN: $(TARGETS) RUN: $(TARGETS)
./CarlaString && ./RtList && ./Thread
# ./CarlaString && ./RtList && ./Thread
# ./GL


# -------------------------------------------------------------- # --------------------------------------------------------------




+ 15
- 5
source/utils/carla_utils.hpp View File

@@ -350,7 +350,7 @@ public:
delete cthread; delete cthread;
} }
#else #else
if (pthreadId != 0)
if (! _isNull())
pthread_join(pthreadId, nullptr); pthread_join(pthreadId, nullptr);


pthread_attr_destroy(&pthreadAttr); pthread_attr_destroy(&pthreadAttr);
@@ -378,9 +378,9 @@ public:


return true; return true;
#else #else
CARLA_ASSERT(pthreadId == 0);
CARLA_ASSERT(_isNull());


if (pthreadId != 0)
if (! _isNull())
return false; return false;


return (pthread_create(&pthreadId, &pthreadAttr, _pthreadRoutine, this) == 0); return (pthread_create(&pthreadId, &pthreadAttr, _pthreadRoutine, this) == 0);
@@ -398,7 +398,7 @@ public:
if (cthread == nullptr) if (cthread == nullptr)
return true; return true;
#else #else
if (pthreadId == 0)
if (_isNull())
return true; return true;
#endif #endif


@@ -440,7 +440,7 @@ public:
if (cthread == nullptr) if (cthread == nullptr)
return; return;
#else #else
if (pthreadId == 0)
if (_isNull())
return; return;
#endif #endif


@@ -515,6 +515,16 @@ private:
{ {
((CarlaThread*)_this_)->handleRoutine(); ((CarlaThread*)_this_)->handleRoutine();
pthread_exit(nullptr); pthread_exit(nullptr);
return nullptr;
}

bool _isNull()
{
#ifdef Q_OS_WIN
return pthreadId.p == nullptr;
#else
return pthreadId == 0;
#endif
} }


void _zero() void _zero()


+ 1
- 1
source/utils/rt_list.hpp View File

@@ -427,7 +427,7 @@ public:
private: private:
typename List<T>::Data* _allocate() typename List<T>::Data* _allocate()
{ {
return (typename List<T>::Data*)malloc(this->fDataSize);
return (typename List<T>::Data*)malloc(this->kDataSize);
} }


void _deallocate(typename List<T>::Data* const dataPtr) void _deallocate(typename List<T>::Data* const dataPtr)


Loading…
Cancel
Save