ucriticalsection.pas
来自「楠楠写的DBiocp例子都是源码」· PAS 代码 · 共 50 行
PAS
50 行
unit uCriticalSection;
interface
uses
Windows;
type
TCriticalSection = class
protected
FCriticalSection: TRTLCriticalSection;
public
constructor Create;
destructor Destroy; override;
procedure Lock;
procedure UnLock;
end;
implementation
constructor TCriticalSection.Create;
begin
inherited Create;
InitializeCriticalSection(FCriticalSection);
end;
destructor TCriticalSection.Destroy;
begin
DeleteCriticalSection(FCriticalSection);
inherited Destroy;
end;
procedure TCriticalSection.Lock;
begin
EnterCriticalSection(FCriticalSection);
end;
procedure TCriticalSection.UnLock;
begin
LeaveCriticalSection(FCriticalSection);
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?