summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugingui/Makefile.am3
-rw-r--r--plugingui/Makefile.mingw323
-rw-r--r--plugingui/plugingui.cc10
-rw-r--r--plugingui/plugingui.h3
4 files changed, 14 insertions, 5 deletions
diff --git a/plugingui/Makefile.am b/plugingui/Makefile.am
index c3664d9..300e594 100644
--- a/plugingui/Makefile.am
+++ b/plugingui/Makefile.am
@@ -11,7 +11,8 @@ plugingui_CFLAGS = $(plugingui_CXXFLAGS)
plugingui_SOURCES = \
$(PLUGIN_GUI_SOURCES) \
- $(top_srcdir)/src/thread.cc
+ $(top_srcdir)/src/thread.cc \
+ $(top_srcdir)/src/semaphore.cc
# $(DRUMGIZMO_SOURCES)
diff --git a/plugingui/Makefile.mingw32 b/plugingui/Makefile.mingw32
index c7a4c53..17e232f 100644
--- a/plugingui/Makefile.mingw32
+++ b/plugingui/Makefile.mingw32
@@ -33,7 +33,8 @@ CXX_SOURCES = \
$(top_srcdir)/plugingui/filebrowser.cc \
$(top_srcdir)/plugingui/knob.cc \
$(top_srcdir)/plugingui/combobox.cc \
- $(top_srcdir)/src/thread.cc
+ $(top_srcdir)/src/thread.cc \
+ $(top_srcdir)/src/semaphore.cc
OBJECTS=$(CXX_SOURCES:.cc=.o) $(C_SOURCES:.c=.o)
#OBJECTS=$(PLUGIN_GUI_SOURCES:.cc=.o)
diff --git a/plugingui/plugingui.cc b/plugingui/plugingui.cc
index 7e4bb59..3fb5984 100644
--- a/plugingui/plugingui.cc
+++ b/plugingui/plugingui.cc
@@ -141,11 +141,13 @@ PluginGUI::PluginGUI(DrumGizmo *drumgizmo)
#else
init();
#endif/*USE_THREAD*/
+
+ sem.wait();
}
PluginGUI::~PluginGUI()
{
- printf("~PluginGUI()\n");
+ DEBUG(plugingui, "~PluginGUI()\n");
running = false;
wait_stop();
@@ -280,6 +282,8 @@ void PluginGUI::init()
fb = filebrowser;
window->show();
+
+ sem.post();
}
static bool shown = false;
@@ -328,6 +332,7 @@ void PluginGUI::setChangeMidimapCallback(void (*handler)(void *, const char *),
void stop(void *ptr)
{
+ DEBUG(stop, "Stopping...\n");
bool *running = (bool*)ptr;
*running = false;
}
@@ -350,7 +355,7 @@ int main()
bool running = true;
PluginGUI gui(NULL);
- //gui.setWindowClosedCallback(stop, &running);
+ gui.setWindowClosedCallback(stop, &running);
// gui.show();
@@ -358,7 +363,6 @@ int main()
// gui.processEvents();
#ifdef WIN32
SleepEx(1000, FALSE);
- printf("loop\n");
#else
// usleep(10000);
sleep(1);
diff --git a/plugingui/plugingui.h b/plugingui/plugingui.h
index a5c75b9..1085601 100644
--- a/plugingui/plugingui.h
+++ b/plugingui/plugingui.h
@@ -40,6 +40,7 @@
#include "filebrowser.h"
#include "thread.h"
+#include "semaphore.h"
class DrumGizmo;
@@ -89,6 +90,8 @@ public:
private:
volatile bool running;
+
+ Semaphore sem;
};
#endif/*__DRUMGIZMO_PLUGINGUI_H__*/