45 #include "wand/studio.h"
46 #include "wand/MagickWand.h"
47 #include "wand/magick-wand-private.h"
48 #include "wand/wand.h"
51 *wand_ids = (SplayTreeInfo *) NULL;
53 static MagickBooleanType
54 instantiate_wand = MagickFalse;
57 *wand_semaphore = (SemaphoreInfo *) NULL;
77 WandExport
size_t AcquireWandId(
void)
80 *wand_id = (
const size_t *) NULL;
88 if (wand_semaphore == (SemaphoreInfo *) NULL)
89 ActivateSemaphoreInfo(&wand_semaphore);
90 LockSemaphoreInfo(wand_semaphore);
91 if (wand_ids == (SplayTreeInfo *) NULL)
92 wand_ids=NewSplayTree((
int (*)(
const void *,
const void *)) NULL,
93 (
void *(*)(
void *)) NULL,(
void *(*)(
void *)) NULL);
95 (void) AddValueToSplayTree(wand_ids,wand_id+
id,wand_id+
id);
96 instantiate_wand=MagickTrue;
97 UnlockSemaphoreInfo(wand_semaphore);
121 WandExport
void DestroyWandIds(
void)
123 if (wand_semaphore == (SemaphoreInfo *) NULL)
124 ActivateSemaphoreInfo(&wand_semaphore);
125 LockSemaphoreInfo(wand_semaphore);
126 if (wand_ids != (SplayTreeInfo *) NULL)
127 wand_ids=DestroySplayTree(wand_ids);
128 instantiate_wand=MagickFalse;
129 UnlockSemaphoreInfo(wand_semaphore);
130 DestroySemaphoreInfo(&wand_semaphore);
155 WandExport
void RelinquishWandId(
const size_t id)
158 *wand_id = (
const size_t *) NULL;
160 LockSemaphoreInfo(wand_semaphore);
161 if (wand_ids != (SplayTreeInfo *) NULL)
162 (void) DeleteNodeFromSplayTree(wand_ids,wand_id+
id);
163 UnlockSemaphoreInfo(wand_semaphore);