小编qgi*_*qgi的帖子

Delphi 中的 TInterfacedObject 自动释放线程安全吗?

和线程安全吗TInterfacedObject._ReleaseTInterfacedObject._AddRef我可以看到FRefCount它是线程安全的,但Destroy不受锁或其他东西的保护。

function TInterfacedObject._Release: Integer;
begin
  Result := InterlockedDecrement(FRefCount);
  if Result = 0 then
    Destroy;
end;
Run Code Online (Sandbox Code Playgroud)

不同的线程Destroy同时执行是否会导致竞争条件?

delphi thread-safety tinterfacedobject

3
推荐指数
1
解决办法
140
查看次数

如何在一个线程中安全地处理一个对象,而另一个线程可以在Delphi中使用该对象?

如何在一个线程中安全地处理一个对象,而另一个线程可以在Delphi中使用该对象?有什么想法或文章要阅读?

delphi multithreading thread-safety

0
推荐指数
1
解决办法
129
查看次数