Commit 4559d228 authored by thomas's avatar thomas
Browse files

no message


git-svn-id: https://svn.grrrr.org/ext/trunk@409 4d9ac71a-51e6-0310-8455-cad1006bcd31
parent a141ac5d
No preview for this file type
/*
flext - C++ layer for Max/MSP and pd (pure data) externals
Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
*/
/*! \file flprefix.h
\brief Try to find out the platform.
*/
#ifndef __FLEXT_PREFIX_H
#define __FLEXT_PREFIX_H
// definitions for FLEXT_SYS
#define FLEXT_SYS_UNKNOWN 0
#define FLEXT_SYS_MAX 1
#define FLEXT_SYS_PD 2
// definitions for FLEXT_OS
#define FLEXT_OS_UNKNOWN 0
#define FLEXT_OS_WIN 1
#define FLEXT_OS_MACOS9 2
#define FLEXT_OS_MACOSX 3
#define FLEXT_OS_LINUX 4
#define FLEXT_OS_IRIX 5
// definitions for FLEXT_CPU
#define FLEXT_CPU_UNKNOWN 0
#define FLEXT_CPU_INTEL 1
#define FLEXT_CPU_PPC 2
#define FLEXT_CPU_MIPS 3
// Old definitions
#if defined(MAXMSP)
#define FLEXT_SYS FLEXT_SYS_MAX
#undef MAXMSP
#elif defined(PD)
#define FLEXT_SYS FLEXT_SYS_PD
#undef PD
#undef NT
#endif
// Definition of supported real-time systems
#if FLEXT_SYS == FLEXT_SYS_MAX
#elif FLEXT_SYS == FLEXT_SYS_PD
#define PD
#else
#error "System must be defined by either FLEXT_SYS_MAX or FLEXT_SYS_PD"
#endif
// Definition of OS/CPU
#if defined(_MSC_VER)
// Microsoft C++
#elif defined(__MWERKS__)
// Metrowerks CodeWarrior
#if defined(__INTEL__)
#define FLEXT_CPU FLEXT_CPU_INTEL
#elif defined(__POWERPC__)
#define FLEXT_CPU FLEXT_CPU_PPC
#elif defined(__MIPS__)
#define FLEXT_CPU FLEXT_CPU_MIPS
#elif defined(__POWERPC__)
#define FLEXT_CPU FLEXT_CPU_UNKNOWN
#endif
#elif defined(__GNUG__)
// GNU C++
#endif
#if FLEXT_OS == FLEXT_OS_WIN
#if FLEXT_SYS == FLEXT_SYS_MAX
#define WIN_VERSION 1
#elif FLEXT_SYS == FLEXT_SYS_PD
#define NT
#endif
#elif FLEXT_OS == FLEXT_OS_LINUX
#if FLEXT_SYS == FLEXT_SYS_MAX
#error "Flext SYS/OS combination unknown"
#endif
#elif FLEXT_OS == FLEXT_OS_IRIX
#if FLEXT_SYS == FLEXT_SYS_MAX
#error "Flext SYS/OS combination unknown"
#endif
#elif FLEXT_OS == FLEXT_OS_MACOS9
#if FLEXT_SYS == FLEXT_SYS_PD
#error "Flext SYS/OS combination unknown"
#endif
#elif FLEXT_OS == FLEXT_OS_MACOSX
#else
#error "Operating system could not be determined"
#endif
#endif
......@@ -54,6 +54,8 @@ bool flext_base::StartThread(void *(*meth)(thr_params *p),thr_params *p,char *me
parm.sched_priority = prio-1;
pthread_setschedparam(id,policy,&parm);
}
post("Create thread");
pthread_t thrid;
int ret = pthread_create (&thrid,&attr,(void *(*)(void *))meth,p);
......@@ -66,6 +68,8 @@ bool flext_base::StartThread(void *(*meth)(thr_params *p),thr_params *p,char *me
#ifdef _DEBUG
error((char *)(ret == EAGAIN?"%s - Unsufficient resources to launch thread!":"%s - Could not launch method!"),methname);
#endif
error((char *)("%s - Could not launch method!"),methname);
delete p;
return false;
}
......@@ -73,6 +77,8 @@ bool flext_base::StartThread(void *(*meth)(thr_params *p),thr_params *p,char *me
#ifdef MAXMSP
sched_yield();
#endif
post("Create thread: OK");
return true;
}
}
......@@ -81,6 +87,8 @@ bool flext_base::PushThread()
{
tlmutex.Lock();
post("Push thread");
// make an entry into thread list
thr_entry *nt = new thr_entry;
if(thrtail) thrtail->nxt = nt;
......@@ -130,6 +138,8 @@ void flext_base::PopThread()
{
tlmutex.Lock();
post("Pop thread");
pthread_t id = pthread_self();
thr_entry *prv = NULL,*ti;
......
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