Ignore:
Timestamp:
Mar 21, 2001, 1:32:55 PM (24 years ago)
Author:
sandervl
Message:

writelog update for disabling logging for threads

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/misc.cpp

    r5332 r5347  
    1 /* $Id: misc.cpp,v 1.32 2001-03-19 19:27:13 sandervl Exp $ */
     1/* $Id: misc.cpp,v 1.33 2001-03-21 12:32:55 sandervl Exp $ */
    22
    33/*
     
    2626#include <stdarg.h>
    2727#include <win32type.h>
     28#include <win32api.h>
    2829#include <misc.h>
    2930#include "initterm.h"
     
    249250static int  oldcrtmsghandle = 0;
    250251
     252static BOOL fDisableThread[5] = {0};
     253
    251254//#define CHECK_ODINHEAP
    252255#if defined(DEBUG) && defined(CHECK_ODINHEAP)
     
    258261
    259262//#define LOG_TIME
    260 #ifdef LOG_TIME
    261 DWORD WIN32API GetTickCount(void);
    262 #endif
    263263
    264264int SYSTEM WriteLog(char *tekst, ...)
     
    266266  USHORT  sel = RestoreOS2FS();
    267267  va_list argptr;
     268  TEB *teb = GetThreadTEB();
    268269
    269270  ODIN_HEAPCHECK();
     
    290291    else
    291292      fLogging = FALSE;
     293
     294    if(getenv("DISABLE_THREAD1")) {
     295      fDisableThread[0] = TRUE;
     296    }
     297    if(getenv("DISABLE_THREAD2")) {
     298      fDisableThread[1] = TRUE;
     299    }
     300    if(getenv("DISABLE_THREAD3")) {
     301      fDisableThread[2] = TRUE;
     302    }
     303    if(getenv("DISABLE_THREAD4")) {
     304      fDisableThread[3] = TRUE;
     305    }
     306    if(getenv("DISABLE_THREAD5")) {
     307      fDisableThread[4] = TRUE;
     308    }
     309  }
     310
     311  if(teb) {
     312      if(teb->o.odin.threadId < 5 && fDisableThread[teb->o.odin.threadId-1] == 1) {
     313          SetFS(sel);
     314          return 1;
     315      }
    292316  }
    293317
    294318  if(fLogging && flog && (dwEnableLogging > 0))
    295319  {
    296     TEB *teb = GetThreadTEB();
    297 
    298320    va_start(argptr, tekst);
    299321    if(teb) {
     
    311333#endif
    312334    }
     335#ifdef LOG_TIME
     336    else {
     337        fprintf(flog, "tX: (%x) ", GetTickCount());
     338    }
     339#endif
    313340    vfprintf(flog, tekst, argptr);
    314341    if(teb) teb->o.odin.logfile = 0;
Note: See TracChangeset for help on using the changeset viewer.