Zumindest kann man dafür sorgen, daß die
DLL-Funktion nur von einem Thread zur selben Zeit benutzt wird:
Delphi-Quellcode:
type
TSensorThread =
class(TThread)
private
class var
FSection: TCriticalSection;
protected
class function GetValues(AID: Integer
{;...}):
{...};
{...}
end;
implementation
class function TSensorThread.GetValues(AID: Integer;
{...}):
{...};
begin
FSection.Enter;
try
Result := s_getvalues(AID,
{...});
//DLL Funktion
finally
FSection.Leave;
end;
end;
initialization
TSensorThread.FSection := TCriticalSection.Create;
finalization
TSensorThread.FSection.Free;
end.