diff --git a/ANSI.c b/ANSI.c index 421ae1f..f2fd53f 100644 --- a/ANSI.c +++ b/ANSI.c @@ -193,6 +193,9 @@ flush and invalidate the cache on CloseHandle; make IsConsoleHandle a critical section, for multithreaded processes; use APIConsole for all console functions (needed for Windows 10). + + v1.83, 16 February, 2018: + create the flush thread on first use. */ #include "ansicon.h" @@ -212,7 +215,7 @@ WORD orgattr; // original attributes DWORD orgmode; // original mode CONSOLE_CURSOR_INFO orgcci; // original cursor state HANDLE hHeap; // local memory heap -HANDLE hBell; +HANDLE hBell, hFlush; #define CACHE 5 struct Cache @@ -2528,6 +2531,8 @@ ParseAndPrintString( HANDLE hDev, { LARGE_INTEGER due; due.QuadPart = -150000; + if (hFlush == NULL) + hFlush = CreateThread( NULL, 4096, FlushThread, NULL, 0, NULL ); SetWaitableTimer( hFlushTimer, &due, 0, NULL, NULL, FALSE ); } } @@ -3897,7 +3902,6 @@ BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved ) InitializeCriticalSection( &CritSect ); hFlushTimer = CreateWaitableTimer( NULL, FALSE, NULL ); - CreateThread( NULL, 4096, FlushThread, NULL, 0, NULL ); } else if (dwReason == DLL_PROCESS_DETACH) { diff --git a/ansicon.c b/ansicon.c index de15e10..5b6a569 100644 --- a/ansicon.c +++ b/ansicon.c @@ -91,7 +91,7 @@ use -pu to unload from the parent. */ -#define PDATE L"13 February, 2018" +#define PDATE L"16 February, 2018" #include "ansicon.h" #include "version.h" diff --git a/readme.txt b/readme.txt index bdaec49..5157a09 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Copyright 2005-2018 Jason Hood - Version 1.82. Freeware + Version 1.83. Freeware Description @@ -339,6 +339,9 @@ Version History Legend: + added, - bug-fixed, * changed. + 1.83 - 16 February, 2018: + - create the flush thread on first use. + 1.82 - 13 February, 2018: - add ANSICON_WRAP for programs that expect the wrap at right margin; - make IsConsoleHandle a critical section, for multithreaded processes; @@ -610,4 +613,4 @@ Distribution ============================== -Jason Hood, 13 February, 2018. +Jason Hood, 16 February, 2018. diff --git a/version.h b/version.h index 032687d..dc543a2 100644 --- a/version.h +++ b/version.h @@ -2,11 +2,11 @@ version.h - Version defines. */ -#define PVERS L"1.82" // wide string -#define PVERSA "1.82" // ANSI string (windres 2.16.91 didn't like L) -#define PVERE L"182" // wide environment string -#define PVEREA "182" // ANSI environment string -#define PVERB 1,8,2,0 // binary (resource) +#define PVERS L"1.83" // wide string +#define PVERSA "1.83" // ANSI string (windres 2.16.91 didn't like L) +#define PVERE L"183" // wide environment string +#define PVEREA "183" // ANSI environment string +#define PVERB 1,8,3,0 // binary (resource) #ifdef _WIN64 # define BITS L"64"