aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/flext/source')
-rw-r--r--externals/grill/flext/source/flext.cpp1
-rwxr-xr-xexternals/grill/flext/source/fllib.cpp2
-rw-r--r--externals/grill/flext/source/flsupport.cpp4
-rw-r--r--externals/grill/flext/source/flsupport.h19
-rw-r--r--externals/grill/flext/source/flthr.cpp6
-rw-r--r--externals/grill/flext/source/flutil.cpp14
6 files changed, 43 insertions, 3 deletions
diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp
index e1a11179..8fe07f89 100644
--- a/externals/grill/flext/source/flext.cpp
+++ b/externals/grill/flext/source/flext.cpp
@@ -169,7 +169,6 @@ void flext_base::Setup(t_classid id)
#ifdef FLEXT_THREADS
thrid = GetThreadId();
- StartHelper();
#endif
}
diff --git a/externals/grill/flext/source/fllib.cpp b/externals/grill/flext/source/fllib.cpp
index f061c2cb..54c5f60f 100755
--- a/externals/grill/flext/source/fllib.cpp
+++ b/externals/grill/flext/source/fllib.cpp
@@ -191,6 +191,8 @@ t_class *flext_obj::getClass(t_classid id) { return reinterpret_cast<libobject *
void flext_obj::lib_init(const char *name,void setupfun(),bool attr)
{
+ flext::Setup();
+
#if FLEXT_SYS == FLEXT_SYS_MAX
lib_name = MakeSymbol(name);
::setup(
diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp
index 05dac9ba..dcac4c75 100644
--- a/externals/grill/flext/source/flsupport.cpp
+++ b/externals/grill/flext/source/flsupport.cpp
@@ -55,6 +55,10 @@ void flext::Setup()
sym_pointer = fts_s_pointer;
#else
#endif
+
+#ifdef FLEXT_THREADS
+ StartHelper();
+#endif
}
diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h
index 1963e56c..760083a8 100644
--- a/externals/grill/flext/source/flsupport.h
+++ b/externals/grill/flext/source/flsupport.h
@@ -505,9 +505,26 @@ public:
const t_symbol *hdr;
};
+
//! @} FLEXT_S_ATOM
+// --- messages -------------------------------------------------------
+
+ /*! \defgroup FLEXT_S_MSG Flext message handling
+ @{
+ */
+
+ //! Send a message to a symbol (bound to an object)
+ static bool Forward(const t_symbol *s,int argc,const t_atom *argv);
+
+ static bool Forward(const t_symbol *s,AtomList &args) { return Forward(s,args.Count(),args.Atoms()); }
+ static bool Forward(const char *s,AtomList &args) { return Forward(MakeSymbol(s),args.Count(),args.Atoms()); }
+
+//! @} FLEXT_S_MSG
+
+
+
// --- thread stuff -----------------------------------------------
#ifdef FLEXT_THREADS
@@ -804,7 +821,7 @@ public:
/*! \brief Launch a thread
\remark thr_params *p may be NULL if not needed
*/
- static bool LaunchThread(void (*meth)(thr_params *p),thr_params *p);
+ static bool LaunchThread(void (*meth)(thr_params *p),thr_params *p = NULL);
//! @} FLEXT_S_THREAD
diff --git a/externals/grill/flext/source/flthr.cpp b/externals/grill/flext/source/flthr.cpp
index 9ad4d75f..d2430041 100644
--- a/externals/grill/flext/source/flthr.cpp
+++ b/externals/grill/flext/source/flthr.cpp
@@ -65,6 +65,12 @@ bool flext::StartHelper()
#endif
if(!ok)
error("flext - Could not launch helper thread!");
+ else {
+ // now we have to wait for thread helper to initialize
+ while(!thrhelpid || !thrhelpcond) Sleep(0.001);
+
+ // we are reading for threading now!
+ }
return ok;
}
diff --git a/externals/grill/flext/source/flutil.cpp b/externals/grill/flext/source/flutil.cpp
index f1035359..09c75377 100644
--- a/externals/grill/flext/source/flutil.cpp
+++ b/externals/grill/flext/source/flutil.cpp
@@ -26,4 +26,16 @@ void flext::ZeroMem(void *dst,int bytes)
}
-
+bool flext::Forward(const t_symbol *recv,int argc,const t_atom *argv)
+{
+ t_class **cl = (t_class **)recv->s_thing;
+ if(!cl) return false;
+
+#if FLEXT_SYS == FLEXT_SYS_PD
+ pd_forwardmess(cl,argc,(t_atom *)argv);
+#else
+ #error Not implemented
+#endif
+
+ return true;
+}