ftp.nice.ch/pub/next/developer/objc/threads/ThreadedApp.1.0.s.tar.gz#/ThreadedApp-1.0/tprintf.c

This is tprintf.c in view mode; [Download] [Up]

#include <stdio.h>
#include <stdarg.h>
#include <mach/cthreads.h>

static mutex_t prtlck;
int dbgtrace;

void tprintf_init()
{
    prtlck = mutex_alloc();
    dbgtrace = FALSE;
}

void tprintf( char *str, ... )
{
    va_list args;

    va_start(args, str);
    mutex_lock(prtlck);
    vprintf( str, args );
    mutex_unlock(prtlck);
    va_end(args);
}

void dbgmsg( char *str, ... )
{
    va_list args;

    if( dbgtrace ){
	va_start(args, str);
	mutex_lock(prtlck);
	vprintf( str, args );
	mutex_unlock(prtlck);
	va_end(args);
    }
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.