pdfEnableMutex
Arm the per-document lock so pdfLockDocument/pdfUnlockDocument
| Category | Threading |
|---|
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
void __stdcall pdfEnableMutex(PPDF IPDF, BOOL32 Value);
procedure pdfEnableMutex(const IPDF: PPDF; Value: LongBool); stdcall; external 'LumasPdf.dll';
Parameters
| Parameter | Type | Description |
|---|---|---|
IPDF | PPDF | Instance handle. |
Value | BOOL32 | TRUE 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 also — pdfLockDocument, pdfUnlockDocument
C# (P/Invoke)
public static extern void pdfEnableMutex(IntPtr IPDF, [MarshalAs(UnmanagedType.Bool)] bool Value);
Core
pdfEnableMutex
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.