프로그래밍 초보 탈출

Libraries/Delphi Library

[IPC] Mutex Library

째즈토끼 2022. 6. 22. 23:42
unit LibMutex;

interface

uses Windows;

  function OpenMutex(const ID : PChar; var Handle : THandle) : Boolean;
  procedure CloseMutex(const Handle : THandle);

implementation

function OpenMutex(const ID : PChar; var Handle : THandle) : Boolean;
begin
  SetLastError(0);
  Handle := CreateMutex(nil, True, ID);
  Result := (Handle <> 0 ) and (GetLastError = 0);
end;

procedure CloseMutex(const Handle : THandle);
begin
  if Handle <> 0 then CloseHandle(Handle);
end;

end.

'Libraries > Delphi Library' 카테고리의 다른 글

[System] OS Version Library  (0) 2022.06.23
[OLE] OLE Command Library  (0) 2022.06.23
[IPC] Memory Map  (0) 2022.06.22
[System] Item ID List Library  (0) 2022.06.22
[WebBrowser] Cookie Library  (0) 2022.06.22