Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TMemoryStream.SaveToFile not thread-safe?

Status
Not open for further replies.

AncientHacker

Programmer
Oct 29, 2009
6
US
Weird. I'm doing this in a thread and it consistently bombs out with "File being accessed by another process".
Should not happen with the csFile as a global TCriticalSection, no?


For Loops := 1 To TestLoops Do
Begin
InMemStream := TMemoryStream.Create( );
Act := InMemStream.Write( Buf, Len );
Dest := 'C:\Mem.Fil';
csFile.Enter;
InMemStream.SaveToFile( Dest );
csFile.Leave;
InMemStream.Free;

End;
 
Please explain where var Loops is being used within the do block...

Roo
Delphi Rules!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top