1
vote
Vote UpVote

Delphi/Turbo Pascal: AppendWithRetry for text files to retry Append

The Wiert Corner – Every once in a while you have multiple threads or processes wanting to write a short message to the same log file. Append then will give you an I/O error 32 (ERROR_SHARING_VIOLATION), but the below small routine will sleep a bit while retrying a couple of times. It uses these Delphi aspects around the $I or $IOCHECKS compiler directive: in $I+ mode, you get exceptions when certain “classic” Pascal style I/O operations fail. in $I- mode, you access the IOResult to obtain the results of those I/O operations IOResult gets the result of the last failed operation (if any) or zero if ...
Favorite? Off-Topic? Jeroen Pluimers @ 2014-03-10 16:48

Statistics

Visits: 740
Votes: 1
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Alister Christie
Subscribe:
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News

Sponsor

 
Please login or register to use this functionality.
(click on this box to dismiss)