Commit b231bb23 authored by thomas's avatar thomas
Browse files

*** empty log message ***


git-svn-id: https://svn.grrrr.org/ext/trunk@265 4d9ac71a-51e6-0310-8455-cad1006bcd31
parent e4dd4b43
......@@ -76,7 +76,7 @@ $(TARGET_TD) : $(patsubst %.cpp,$(TARGDIR)/%.tdo,$(SRCS))
.PHONY: clean install
clean:
rm -f $(TARGDIR)/*.o $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD)
rm -f $(TARGDIR)/*.{o,do,to,tdo} $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD)
$(INSTDIR):
-mkdir $(INSTDIR)
......
......@@ -425,8 +425,7 @@ static void *thr_ ## M_FUN(thr_params *p) { \
}
/*! \brief Set up a threaded method callback for an arbitrary data struct
\note Pointer of data struct is only borrowed ... no destruction is done
\note This can be done in the called method
\note Data is pure... no destructor is called upon delete
*/
#define FLEXT_THREAD_X(M_FUN) \
static void cb_ ## M_FUN(flext_base *c,void *data) { \
......
......@@ -29,15 +29,22 @@ WARRANTIES, see the file, "license.txt," in this distribution.
bool flext_base::StartThread(void *(*meth)(thr_params *p),thr_params *p,char *methname)
{
static bool init = false;
static pthread_attr_t attr;
#ifdef _DEBUG
if(!p) {
ERRINTERNAL();
return false;
}
#endif
if(!init) {
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED);
init = true;
}
pthread_t thrid;
int ret = pthread_create (&thrid,NULL,(void *(*)(void *))meth,p);
int ret = pthread_create (&thrid,&attr,(void *(*)(void *))meth,p);
if(ret) {
error((char *)(ret == EAGAIN?"%s - Unsufficient resources to launch thread!":"%s - Could not launch method!"),methname);
delete p;
......
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