Commit d3cc649a authored by thomas's avatar thomas
Browse files

no message


git-svn-id: https://svn.grrrr.org/ext/trunk@441 4d9ac71a-51e6-0310-8455-cad1006bcd31
parent 9b108d17
......@@ -20,7 +20,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "flstdc.h"
#include "flsupport.h"
class flext_obj;
class FLEXT_EXT flext_obj;
// ----------------------------------------------------------------------------
/*! \brief The obligatory PD or Max/MSP object header
......@@ -85,7 +85,7 @@ struct FLEXT_EXT flext_hdr
*/
// ----------------------------------------------------------------------------
class flext_obj:
class FLEXT_EXT flext_obj:
public flext
{
public:
......
......@@ -40,7 +40,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
*/
class flext_base:
class FLEXT_EXT flext_base:
public flext_obj
{
FLEXT_HEADER_S(flext_base,flext_obj,Setup)
......
......@@ -24,7 +24,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
/*! \brief Flext dsp enabled base object
*/
class flext_dsp:
class FLEXT_EXT flext_dsp:
public flext_base
{
FLEXT_HEADER_S(flext_dsp,flext_base,Setup)
......
......@@ -430,7 +430,6 @@ public:
//! Check if current thread is the realtime system's thread
static bool IsSystemThread() { return IsThread(GetSysThreadId()); }
protected:
/*! \brief Thread parameters
\internal
......@@ -481,6 +480,8 @@ protected:
thr_entry *nxt;
};
protected:
static thrid_t thrhelpid;
static bool StartHelper();
static bool StopHelper();
......@@ -532,7 +533,7 @@ public:
/*! \brief Thread mutex
\sa pthreads documentation
*/
class ThrMutex
class FLEXT_EXT ThrMutex
#if FLEXT_THREADS == FLEXT_THR_POSIX
{
public:
......@@ -586,7 +587,7 @@ public:
/*! \brief Thread conditional
\sa pthreads documentation
*/
class ThrCond
class FLEXT_EXT ThrCond
#if FLEXT_THREADS == FLEXT_THR_POSIX
:public ThrMutex
{
......@@ -672,16 +673,6 @@ public:
*/
static bool LaunchThread(void (*meth)(thr_params *p),thr_params *p);
protected:
//! thread list
static thr_entry *thrhead,*thrtail;
//! mutex for thread list
static ThrMutex tlmutex;
public:
//! @} FLEXT_S_THREAD
#endif // FLEXT_THREADS
......
......@@ -25,24 +25,18 @@ flext::thrid_t flext::thrid;
//! Thread id of helper thread
flext::thrid_t flext::thrhelpid;
/*
flext::thr_entry *flext::thrhead = NULL,*flext::thrtail = NULL;
flext::ThrMutex flext::tlmutex;
*/
static flext::thr_entry *thrhead = NULL,*thrtail = NULL;
static flext::ThrMutex tlmutex;
//! Helper thread should terminate
bool thrhelpexit = false;
static bool thrhelpexit = false;
//! Helper thread conditional
flext::ThrCond *thrhelpcond = NULL;
flext_base::thr_entry::thr_entry(void (*m)(thr_params *),thr_params *p,thrid_t id):
th(p->cl),meth(m),params(p),thrid(id),
active(false),shouldexit(false),
#if FLEXT_THREADS == FLEXT_THR_MP
weight(100), // MP default weight
#endif
nxt(NULL)
{}
static flext::ThrCond *thrhelpcond = NULL;
//! Start helper thread
......@@ -160,7 +154,7 @@ void flext::ThrHelper(void *)
bool flext::LaunchThread(void (*meth)(thr_params *p),thr_params *p)
{
#ifdef FLEXT_DEBUG
if(!p || !thrhelpcond) {
if(!thrhelpcond) {
ERRINTERNAL();
return false;
}
......@@ -228,7 +222,7 @@ void flext::PopThread()
}
else {
#ifdef FLEXT_DEBUG
post("%s - INTERNAL ERROR: Thread not found!",thisName());
post("flext - INTERNAL ERROR: Thread not found!");
#endif
}
......@@ -421,10 +415,22 @@ bool flext::SetPriority(int p,thrid_t id)
#endif
}
flext_base::thr_params::thr_params(int n): cl(NULL),var(new _data[n]) {}
flext_base::thr_params::~thr_params() { if(var) delete[] var; }
void flext_base::thr_params::set_any(const t_symbol *s,int argc,const t_atom *argv) { var[0]._any.args = new AtomAnything(s,argc,argv); }
void flext_base::thr_params::set_list(int argc,const t_atom *argv) { var[0]._list.args = new AtomList(argc,argv); }
flext_base::thr_entry::thr_entry(void (*m)(thr_params *),thr_params *p,thrid_t id):
th(p?p->cl:NULL),meth(m),params(p),thrid(id),
active(false),shouldexit(false),
#if FLEXT_THREADS == FLEXT_THR_MP
weight(100), // MP default weight
#endif
nxt(NULL)
{}
#endif // FLEXT_THREADS
#N canvas 105 266 700 343 12;
#X obj 39 91 bng 25 250 50 0 empty empty start 0 -6 32 8 -261681 -1
-1;
#X obj 39 244 thread1;
#X obj 130 246 thread1;
#X obj 220 247 thread1;
#X obj 312 247 thread1;
#X obj 405 247 thread1;
#X obj 131 185 delay 200;
#X obj 220 184 delay 200;
#X obj 313 186 delay 200;
#X obj 404 185 delay 200;
#X text 78 85 click to start;
#X text 126 103 (if you click twice \, the same thread is started a
second time);
#X obj 16 8 cnv 15 550 40 empty empty thread1 10 22 32 24 -260818 -1
0;
#X text 175 8 flext tutorial \, (C)2002 Thomas Grill;
#X text 175 28 http://www.parasitaere-kapazitaeten.net;
#X obj 39 277 nbx 5 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 32 12
-228992 -1 -1 0 256;
#X obj 131 277 nbx 5 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 32
12 -228992 -1 -1 0 256;
#X obj 221 277 nbx 5 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 32
12 -228992 -1 -1 0 256;
#X obj 311 277 nbx 5 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 32
12 -228992 -1 -1 0 256;
#X obj 406 276 nbx 5 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 32
12 -228992 -1 -1 0 256;
#X connect 0 0 1 0;
#X connect 0 0 6 0;
#X connect 1 0 15 0;
#X connect 2 0 16 0;
#X connect 3 0 17 0;
#X connect 4 0 18 0;
#X connect 5 0 19 0;
#X connect 6 0 2 0;
#X connect 6 0 7 0;
#X connect 7 0 3 0;
#X connect 7 0 8 0;
#X connect 8 0 4 0;
#X connect 8 0 9 0;
#X connect 9 0 5 0;
#N canvas 105 266 702 345 12;
#X obj 39 91 bng 25 250 50 0 empty empty start 0 -6 0 8 -261681 -1
-1;
#X obj 130 246 thread1;
#X obj 220 247 thread1;
#X obj 312 247 thread1;
#X obj 405 247 thread1;
#X obj 131 185 delay 200;
#X obj 220 184 delay 200;
#X obj 313 186 delay 200;
#X obj 404 185 delay 200;
#X text 78 85 click to start;
#X text 126 103 (if you click twice \, the same thread is started a
second time);
#X obj 16 8 cnv 15 550 40 empty empty thread1 10 22 0 24 -260818 -1
0;
#X text 175 8 flext tutorial \, (C)2002 Thomas Grill;
#X text 175 28 http://www.parasitaere-kapazitaeten.net;
#X obj 131 277 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
12 -228992 -1 -1 0 256;
#X obj 221 277 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
12 -228992 -1 -1 0 256;
#X obj 311 277 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
12 -228992 -1 -1 0 256;
#X obj 406 276 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
12 -228992 -1 -1 0 256;
#X obj 39 244 thread1;
#X obj 39 277 nbx 5 16 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
12 -228992 -1 -1 0 256;
#X connect 0 0 5 0;
#X connect 0 0 18 0;
#X connect 1 0 14 0;
#X connect 2 0 15 0;
#X connect 3 0 16 0;
#X connect 4 0 17 0;
#X connect 5 0 1 0;
#X connect 5 0 6 0;
#X connect 6 0 2 0;
#X connect 6 0 7 0;
#X connect 7 0 3 0;
#X connect 7 0 8 0;
#X connect 8 0 4 0;
#X connect 18 0 19 0;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment