API referenceCore SDK

pdfEnableMutex

Arm the per-document lock so pdfLockDocument/pdfUnlockDocument

CategoryThreading

Purpose — Arm the per-document lock so pdfLockDocument/pdfUnlockDocument serialise cross-thread access.

Description — Sets the instance's FMutexEnabled flag. When armed, the paired lock primitives pdfLockDocument/pdfUnlockDocument (and internal mutating paths that consult the lock) serialise access across threads; the lock is recursive for the owning thread. When disabled (the default), those primitives are cheap no-ops. Enable it before you begin using one instance from more than one thread.

Declarations

C
void __stdcall pdfEnableMutex(PPDF IPDF, BOOL32 Value);
Delphi
procedure pdfEnableMutex(const IPDF: PPDF; Value: LongBool); stdcall; external 'LumasPdf.dll';

Parameters

ParameterTypeDescription
IPDFPPDFInstance handle.
ValueBOOL32TRUE to arm the lock, FALSE to disable.

Return value — None. No-op on an invalid handle.

Remarks — A single PPDF is still "single-thread-at-a-time"; the mutex makes that safe when threads cooperate through pdfLockDocument/pdfUnlockDocument. It is not a substitute for using one instance per worker thread where possible. Pair every successful pdfLockDocument with exactly one pdfUnlockDocument.

See alsopdfLockDocument, pdfUnlockDocument

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern void pdfEnableMutex(IntPtr IPDF, [MarshalAs(UnmanagedType.Bool)] bool Value);
Area
Core SDK
Category

Core

Exported names

pdfEnableMutex

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.