[PD-cvs] externals/grill/flext/source flsupport.cpp,1.23,1.24
xovo at users.sourceforge.net
xovo at users.sourceforge.net
Wed Nov 19 04:32:56 CET 2003
Update of /cvsroot/pure-data/externals/grill/flext/source
In directory sc8-pr-cvs1:/tmp/cvs-serv8417/source
Modified Files:
flsupport.cpp
Log Message:
""
Index: flsupport.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flsupport.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** flsupport.cpp 24 Sep 2003 02:34:55 -0000 1.23
--- flsupport.cpp 19 Nov 2003 03:32:54 -0000 1.24
***************
*** 75,78 ****
--- 75,87 ----
+ #if defined(FLEXT_THREADED) && defined(FLEXT_PDLOCK)
+ #define SYSLOCK() sys_lock()
+ #define SYSUNLOCK() sys_unlock()
+ #else
+ #define SYSLOCK(on) (void)0
+ #define SYSUNLOCK(on) (void)0
+ #endif
+
+
/////////////////////////////////////////////////////////
// overloaded new/delete memory allocation methods
***************
*** 102,105 ****
--- 111,115 ----
{
char *ori = (char *)blk-sizeof(size_t);
+
#if FLEXT_SYS == FLEXT_SYS_JMAX
fts_free(ori);
***************
*** 115,118 ****
--- 125,129 ----
const unsigned long alignovh = bitalign/8-1;
bytes += ovh+alignovh;
+
#if FLEXT_SYS == FLEXT_SYS_JMAX
char *blk = (char *)::fts_malloc(bytes);
***************
*** 120,123 ****
--- 131,135 ----
char *blk = (char *)::getbytes(bytes);
#endif
+
char *ablk = reinterpret_cast<char *>((reinterpret_cast<unsigned long>(blk)+ovh+alignovh) & ~alignovh);
*(char **)(ablk-sizeof(size_t)-sizeof(char *)) = blk;
***************
*** 185,229 ****
void flext_root::post(const char *fmt, ...)
{
- #ifdef FLEXT_THREADS
- static flext::ThrMutex mutex;
- mutex.Lock();
- #endif
va_list ap;
va_start(ap, fmt);
! #if FLEXT_SYS == FLEXT_SYS_MAX
char buf[1024]; // \TODO this is quite unsafe.....
vsprintf(buf, fmt, ap);
::post(buf);
! #else
! vfprintf(stderr, fmt, ap);
! ::post("");
! #endif
va_end(ap);
- #ifdef FLEXT_THREADS
- mutex.Unlock();
- #endif
}
void flext_root::error(const char *fmt,...)
{
- #ifdef FLEXT_THREADS
- static flext::ThrMutex mutex;
- mutex.Lock();
- #endif
va_list ap;
va_start(ap, fmt);
! #if FLEXT_SYS == FLEXT_SYS_MAX
char buf[1024]; // \TODO this is quite unsafe.....
STD::sprintf(buf,"error: ");
vsprintf(buf+7, fmt, ap);
::post(buf);
! #else
! fprintf(stderr, "error: ");
! vfprintf(stderr, fmt, ap);
! ::post("");
! #endif
va_end(ap);
- #ifdef FLEXT_THREADS
- mutex.Unlock();
- #endif
}
--- 197,220 ----
void flext_root::post(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
!
char buf[1024]; // \TODO this is quite unsafe.....
vsprintf(buf, fmt, ap);
::post(buf);
!
va_end(ap);
}
void flext_root::error(const char *fmt,...)
{
va_list ap;
va_start(ap, fmt);
!
char buf[1024]; // \TODO this is quite unsafe.....
STD::sprintf(buf,"error: ");
vsprintf(buf+7, fmt, ap);
::post(buf);
!
va_end(ap);
}
More information about the Pd-cvs
mailing list