42 #include "wand/studio.h"
43 #include "wand/MagickWand.h"
44 #include "wand/magick-wand-private.h"
45 #include "wand/wand.h"
48 *wand_ids = (SplayTreeInfo *) NULL;
50 static MagickBooleanType
51 instantiate_wand = MagickFalse;
54 *wand_semaphore = (SemaphoreInfo *) NULL;
74 WandExport
size_t AcquireWandId(
void)
82 if (wand_semaphore == (SemaphoreInfo *) NULL)
83 ActivateSemaphoreInfo(&wand_semaphore);
84 LockSemaphoreInfo(wand_semaphore);
85 if (wand_ids == (SplayTreeInfo *) NULL)
86 wand_ids=NewSplayTree((
int (*)(
const void *,
const void *)) NULL,
87 (
void *(*)(
void *)) NULL,(
void *(*)(
void *)) NULL);
89 (void) AddValueToSplayTree(wand_ids,(
const void *) wand_id,
90 (
const void *) wand_id);
91 instantiate_wand=MagickTrue;
92 UnlockSemaphoreInfo(wand_semaphore);
116 WandExport
void DestroyWandIds(
void)
118 if (wand_semaphore == (SemaphoreInfo *) NULL)
119 ActivateSemaphoreInfo(&wand_semaphore);
120 LockSemaphoreInfo(wand_semaphore);
121 if (wand_ids != (SplayTreeInfo *) NULL)
122 wand_ids=DestroySplayTree(wand_ids);
123 instantiate_wand=MagickFalse;
124 UnlockSemaphoreInfo(wand_semaphore);
125 DestroySemaphoreInfo(&wand_semaphore);
150 WandExport
void RelinquishWandId(
const size_t id)
152 LockSemaphoreInfo(wand_semaphore);
153 if (wand_ids != (SplayTreeInfo *) NULL)
154 (void) DeleteNodeFromSplayTree(wand_ids,(
const void *) id);
155 UnlockSemaphoreInfo(wand_semaphore);