45#include "MagickWand/studio.h"
46#include "MagickWand/MagickWand.h"
47#include "MagickWand/magick-wand-private.h"
48#include "MagickWand/wand.h"
51 *wand_ids = (SplayTreeInfo *) NULL;
54 *wand_semaphore = (SemaphoreInfo *) NULL;
74WandExport
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,(
const void *)
91 UnlockSemaphoreInfo(wand_semaphore);
92 return((
size_t) wand_id);
115WandExport
void DestroyWandIds(
void)
117 if (wand_semaphore == (SemaphoreInfo *) NULL)
118 ActivateSemaphoreInfo(&wand_semaphore);
119 LockSemaphoreInfo(wand_semaphore);
120 if (wand_ids != (SplayTreeInfo *) NULL)
121 wand_ids=DestroySplayTree(wand_ids);
122 UnlockSemaphoreInfo(wand_semaphore);
123 RelinquishSemaphoreInfo(&wand_semaphore);
148WandExport
void RelinquishWandId(
const size_t id)
151 wand_id = (MagickAddressType)
id;
153 LockSemaphoreInfo(wand_semaphore);
154 if (wand_ids != (SplayTreeInfo *) NULL)
155 (void) DeleteNodeFromSplayTree(wand_ids,(
const void *) wand_id);
156 UnlockSemaphoreInfo(wand_semaphore);