Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | avoid GPF in AutoFlushProc background thread |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
3f7908feb52d4cc700afa5c76808d6b6 |
User & Date: | ab 2011-06-04 18:20:42 |
2011-06-06
| ||
14:41 | SynProject: fixed issue when formating code in RTF content (avoid prematurated doc end) check-in: 59137532bf user: ab tags: trunk | |
2011-06-04
| ||
18:20 | avoid GPF in AutoFlushProc background thread check-in: 3f7908feb5 user: ab tags: trunk | |
2011-06-03
| ||
15:55 |
| |
Changes to SynCommons.pas.
24935
24936
24937
24938
24939
24940
24941
24942
24943
24944
24945
24946
24947
24948
24949
24950
24951
24952
24953
24954
24955
24956
24957
24958
24959
24960
24961
24962
24963
.....
24973
24974
24975
24976
24977
24978
24979
24980
24981
24982
24983
24984
24985
24986
24987
|
AutoFlushThread: THandle = 0; AutoFlushSecondElapsed: cardinal; procedure AutoFlushProc(P: pointer); stdcall; // TThread not needed here var i: integer; begin repeat Sleep(1000); // thread will awake every second to check of pending data if SynLogFile=nil then continue; inc(AutoFlushSecondElapsed); for i := 0 to SynLogFile.Count-1 do with TSynLog(SynLogFile.List[i]) do if (fFamily.fAutoFlush<>0) and (fWriter<>nil) and (AutoFlushSecondElapsed mod fFamily.fAutoFlush=0) then if fWriter.B-fWriter.fTempBuf>1 then begin if not IsMultiThread and not fWriterStream.InheritsFrom(TFileStream) then IsMultiThread := true; // only TFileStream is thread-safe Flush(false); // write pending data end; until false; end; procedure TSynLogFamily.SetAutoFlush(TimeOut: cardinal); var ID: cardinal; begin SynLog.CreateLocker; fAutoFlush := TimeOut; ................................................................................ aTime: TDateTime; Y,M,D: word; aOldLogFileName, aPath: TFileName; tmp: array[0..11] of AnsiChar; begin if AutoFlushThread<>0 then begin CloseHandle(AutoFlushThread); // release background thread once for all AutoFlushThread := 0; end; FreeAndNil(fExceptionIgnore); try if Assigned(OnArchive) then if FindFirst(DestinationPath+'*.log',faAnyFile,SR)=0 then try if ArchiveAfterDays<0 then |
|
>
>
|
>
>
>
|
|
24935
24936
24937
24938
24939
24940
24941
24942
24943
24944
24945
24946
24947
24948
24949
24950
24951
24952
24953
24954
24955
24956
24957
24958
24959
24960
24961
24962
24963
24964
24965
24966
24967
24968
.....
24978
24979
24980
24981
24982
24983
24984
24985
24986
24987
24988
24989
24990
24991
24992
|
AutoFlushThread: THandle = 0; AutoFlushSecondElapsed: cardinal; procedure AutoFlushProc(P: pointer); stdcall; // TThread not needed here var i: integer; begin repeat Sleep(1000); // thread will awake every second to check of pending data if AutoFlushThread=0 then break; // avoid GPF if SynLogFile=nil then continue; // nothing to flush inc(AutoFlushSecondElapsed); for i := 0 to SynLogFile.Count-1 do with TSynLog(SynLogFile.List[i]) do if AutoFlushThread=0 then break else // avoid GPF if (fFamily.fAutoFlush<>0) and (fWriter<>nil) and (AutoFlushSecondElapsed mod fFamily.fAutoFlush=0) then if fWriter.B-fWriter.fTempBuf>1 then begin if not IsMultiThread and not fWriterStream.InheritsFrom(TFileStream) then IsMultiThread := true; // only TFileStream is thread-safe Flush(false); // write pending data end; until false; ExitThread(0); end; procedure TSynLogFamily.SetAutoFlush(TimeOut: cardinal); var ID: cardinal; begin SynLog.CreateLocker; fAutoFlush := TimeOut; ................................................................................ aTime: TDateTime; Y,M,D: word; aOldLogFileName, aPath: TFileName; tmp: array[0..11] of AnsiChar; begin if AutoFlushThread<>0 then begin CloseHandle(AutoFlushThread); // release background thread once for all AutoFlushThread := 0; // mark thread released to avoid GPF in AutoFlushProc end; FreeAndNil(fExceptionIgnore); try if Assigned(OnArchive) then if FindFirst(DestinationPath+'*.log',faAnyFile,SR)=0 then try if ArchiveAfterDays<0 then |