On 14/10/16 02:43, Snorkl e wrote:
Anyway, I am using a third party SFTP server lib and it creates a thread
inherited from tthread and in the create event of the tthread descendant
it does this:
(It uses this thread to read and write data on the socket)

FDataAvailable := TEvent.Create(nil, True, False, '');  //tevent maps to


GetLastError() will return the error code of the last Windows API call that has been performed. I doubt TEvent.Create() guarantees not to call any Windows API's between creating an event using a Windows event and returning. E.g., it might allocate or free memory in between, or the FPC RTL may have done that in the context of handling the constructor call.

You should only call GetLastError() immediately after calling a Windows API function yourself. In any other case, you cannot know what may have transpired in between.

fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org

Reply via email to