Changeset 452 for WizardsToolkit/trunk
- Timestamp:
- 10/25/09 11:36:27 (4 weeks ago)
- Location:
- WizardsToolkit/trunk/wizard
- Files:
-
- 13 modified
-
blob.c (modified) (1 diff)
-
configure.c (modified) (11 diffs)
-
configure.h (modified) (1 diff)
-
exception.c (modified) (9 diffs)
-
file.c (modified) (6 diffs)
-
log.c (modified) (19 diffs)
-
memory.c (modified) (9 diffs)
-
mime.c (modified) (10 diffs)
-
random.c (modified) (2 diffs)
-
resource.c (modified) (16 diffs)
-
semaphore.c (modified) (1 diff)
-
studio.h (modified) (1 diff)
-
wizard.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
WizardsToolkit/trunk/wizard/blob.c
r1 r452 329 329 blob_info->filename); 330 330 destroy=WizardFalse; 331 AcquireSemaphoreInfo(&blob_info->semaphore);331 LockSemaphoreInfo(blob_info->semaphore); 332 332 blob_info->reference_count--; 333 333 if (blob_info->reference_count == 0) 334 334 destroy=WizardTrue; 335 RelinquishSemaphoreInfo(blob_info->semaphore);335 UnlockSemaphoreInfo(blob_info->semaphore); 336 336 if (destroy == WizardFalse) 337 337 return(blob_info); -
WizardsToolkit/trunk/wizard/configure.c
r425 r452 76 76 ConfigureMap[] = 77 77 { 78 { "NAME", "ImageMagick" } 78 79 }; 79 80 … … 99 100 % % 100 101 % % 101 + D e s t r o y C o n f i g u r e L i s t % 102 % % 103 % % 104 % % 105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 106 % 107 % DestroyConfigureList() deallocates memory associated with the configure list. 108 % 109 % The format of the DestroyConfigureList method is: 110 % 111 % DestroyConfigureList(void) 112 % 102 + C o n f i g u r e C o m p o n e n t G e n e s i s % 103 % % 104 % % 105 % % 106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 107 % 108 % ConfigureComponentGenesis() instantiates the configure component. 109 % 110 % The format of the ConfigureComponentGenesis method is: 111 % 112 % WizardBooleanType ConfigureComponentGenesis(void) 113 % 114 */ 115 WizardExport WizardBooleanType ConfigureComponentGenesis(void) 116 { 117 assert(configure_semaphore == (SemaphoreInfo *) NULL); 118 configure_semaphore=AllocateSemaphoreInfo(); 119 return(WizardTrue); 120 } 121 122 /* 123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 124 % % 125 % % 126 % % 127 + C o n f i g u r e C o m p o n e n t T e r m i n u s % 128 % % 129 % % 130 % % 131 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 132 % 133 % ConfigureComponentTerminus() deallocates memory associated with the 134 % configure list. 135 % 136 % The format of the ConfigureComponentTerminus method is: 137 % 138 % ConfigureComponentTerminus(void) 113 139 % 114 140 */ … … 133 159 } 134 160 135 WizardExport void DestroyConfigureList(void) 136 { 137 AcquireSemaphoreInfo(&configure_semaphore); 161 WizardExport void ConfigureComponentTerminus(void) 162 { 163 if (configure_semaphore == (SemaphoreInfo *) NULL) 164 AcquireSemaphoreInfo(&configure_semaphore); 165 LockSemaphoreInfo(configure_semaphore); 138 166 if (configure_list != (LinkedListInfo *) NULL) 139 167 configure_list=DestroyLinkedList(configure_list,DestroyConfigureElement); 140 168 configure_list=(LinkedListInfo *) NULL; 141 169 instantiate_configure=WizardFalse; 142 RelinquishSemaphoreInfo(configure_semaphore);170 UnlockSemaphoreInfo(configure_semaphore); 143 171 DestroySemaphoreInfo(&configure_semaphore); 144 172 } … … 228 256 Search for named configure. 229 257 */ 230 AcquireSemaphoreInfo(&configure_semaphore);258 LockSemaphoreInfo(configure_semaphore); 231 259 ResetLinkedListIterator(configure_list); 232 260 p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list); … … 243 271 (void) InsertValueInLinkedList(configure_list,0, 244 272 RemoveElementByValueFromLinkedList(configure_list,p)); 245 RelinquishSemaphoreInfo(configure_semaphore);273 UnlockSemaphoreInfo(configure_semaphore); 246 274 return(p); 247 275 } … … 327 355 Generate configure list. 328 356 */ 329 AcquireSemaphoreInfo(&configure_semaphore);357 LockSemaphoreInfo(configure_semaphore); 330 358 ResetLinkedListIterator(configure_list); 331 359 p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list); … … 337 365 p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list); 338 366 } 339 RelinquishSemaphoreInfo(configure_semaphore);367 UnlockSemaphoreInfo(configure_semaphore); 340 368 qsort((void *) options,(size_t) i,sizeof(*options),ConfigureInfoCompare); 341 369 options[i]=(ConfigureInfo *) NULL; … … 414 442 if (p == (const ConfigureInfo *) NULL) 415 443 return((char **) NULL); 416 AcquireSemaphoreInfo(&configure_semaphore);417 RelinquishSemaphoreInfo(configure_semaphore);444 LockSemaphoreInfo(configure_semaphore); 445 UnlockSemaphoreInfo(configure_semaphore); 418 446 options=(char **) AcquireQuantumMemory((size_t) 419 447 GetNumberOfElementsInLinkedList(configure_list)+1UL,sizeof(*options)); 420 448 if (options == (char **) NULL) 421 449 return((char **) NULL); 422 AcquireSemaphoreInfo(&configure_semaphore);450 LockSemaphoreInfo(configure_semaphore); 423 451 ResetLinkedListIterator(configure_list); 424 452 p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list); … … 430 458 p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list); 431 459 } 432 RelinquishSemaphoreInfo(configure_semaphore);460 UnlockSemaphoreInfo(configure_semaphore); 433 461 qsort((void *) options,(size_t) i,sizeof(*options),ConfigureCompare); 434 462 options[i]=(char *) NULL; … … 791 819 (instantiate_configure == WizardFalse)) 792 820 { 793 AcquireSemaphoreInfo(&configure_semaphore);821 LockSemaphoreInfo(configure_semaphore); 794 822 if ((configure_list == (LinkedListInfo *) NULL) && 795 823 (instantiate_configure == WizardFalse)) … … 798 826 instantiate_configure=WizardTrue; 799 827 } 800 RelinquishSemaphoreInfo(configure_semaphore);828 UnlockSemaphoreInfo(configure_semaphore); 801 829 } 802 830 return(configure_list != (LinkedListInfo *) NULL ? WizardTrue : WizardFalse); -
WizardsToolkit/trunk/wizard/configure.h
r425 r452 56 56 57 57 extern WizardExport WizardBooleanType 58 ConfigureComponentGenesis(void), 58 59 ListConfigureInfo(FILE *,ExceptionInfo *); 59 60 60 61 extern WizardExport void 61 DestroyConfigureList(void);62 ConfigureComponentTerminus(void); 62 63 63 64 #if defined(__cplusplus) || defined(c_plusplus) -
WizardsToolkit/trunk/wizard/exception.c
r1 r452 185 185 if (exception->exceptions == (void *) NULL) 186 186 return; 187 AcquireSemaphoreInfo(&exception->semaphore);187 LockSemaphoreInfo(exception->semaphore); 188 188 p=(ExceptionInfo *) RemoveLastElementFromLinkedList((LinkedListInfo *) 189 189 exception->exceptions); … … 197 197 exception->reason=(char *) NULL; 198 198 exception->description=(char *) NULL; 199 RelinquishSemaphoreInfo(exception->semaphore);199 UnlockSemaphoreInfo(exception->semaphore); 200 200 errno=0; 201 201 } … … 233 233 if (exception->exceptions == (void *) NULL) 234 234 return; 235 AcquireSemaphoreInfo(&exception->semaphore);235 LockSemaphoreInfo(exception->semaphore); 236 236 ResetLinkedListIterator((LinkedListInfo *) exception->exceptions); 237 237 p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) … … 248 248 exception->exceptions); 249 249 } 250 RelinquishSemaphoreInfo(exception->semaphore);250 UnlockSemaphoreInfo(exception->semaphore); 251 251 ClearWizardException(exception); 252 252 } … … 401 401 assert(exception != (ExceptionInfo *) NULL); 402 402 assert(exception->signature == WizardSignature); 403 AcquireSemaphoreInfo(&exception->semaphore);403 LockSemaphoreInfo(exception->semaphore); 404 404 exception->severity=UndefinedException; 405 405 if (exception->exceptions != (void *) NULL) … … 407 407 exception->exceptions,DestroyExceptionElement); 408 408 exception->signature=(~WizardSignature); 409 RelinquishSemaphoreInfo(exception->semaphore);409 UnlockSemaphoreInfo(exception->semaphore); 410 410 DestroySemaphoreInfo(&exception->semaphore); 411 411 if (exception->relinquish != WizardFalse) … … 442 442 exception->severity=UndefinedException; 443 443 exception->exceptions=(void *) NewLinkedList(0); 444 exception->semaphore=AllocateSemaphoreInfo(); 444 445 exception->signature=WizardSignature; 445 446 } … … 662 663 if (relative->exceptions == (void *) NULL) 663 664 return; 664 AcquireSemaphoreInfo(&exception->semaphore);665 LockSemaphoreInfo(exception->semaphore); 665 666 ResetLinkedListIterator((LinkedListInfo *) relative->exceptions); 666 667 p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) … … 672 673 relative->exceptions); 673 674 } 674 RelinquishSemaphoreInfo(exception->semaphore);675 UnlockSemaphoreInfo(exception->semaphore); 675 676 } 676 677 -
WizardsToolkit/trunk/wizard/file.c
r1 r452 147 147 assert(file_info->signature == WizardSignature); 148 148 (void) LogWizardEvent(TraceEvent,GetWizardModule(),"%s",file_info->path); 149 AcquireSemaphoreInfo(&file_info->semaphore);149 LockSemaphoreInfo(file_info->semaphore); 150 150 path=AcquireString(file_info->path); 151 151 AppendFileExtension("lck",path); … … 176 176 { 177 177 path=DestroyString(path); 178 RelinquishSemaphoreInfo(file_info->semaphore);178 UnlockSemaphoreInfo(file_info->semaphore); 179 179 return(WizardTrue); 180 180 } … … 220 220 } 221 221 path=DestroyString(path); 222 RelinquishSemaphoreInfo(file_info->semaphore);222 UnlockSemaphoreInfo(file_info->semaphore); 223 223 return(WizardFalse); 224 224 } … … 278 278 file_info->path=AcquireString((char *) NULL); 279 279 file_info->file=(-1); 280 file_info->semaphore= (SemaphoreInfo *) NULL;280 file_info->semaphore=AllocateSemaphoreInfo(); 281 281 file_info->timestamp=time((time_t *) NULL); 282 282 file_info->signature=WizardSignature; … … 433 433 assert(file_info->signature == WizardSignature); 434 434 (void) LogWizardEvent(TraceEvent,GetWizardModule(),"%s",file_info->path); 435 AcquireSemaphoreInfo(&file_info->semaphore);435 LockSemaphoreInfo(file_info->semaphore); 436 436 if (file_info->file >= 0) 437 437 if (close(file_info->file) == -1) … … 443 443 file_info->path=DestroyString(file_info->path); 444 444 file_info->signature=(~WizardSignature); 445 RelinquishSemaphoreInfo(file_info->semaphore);445 UnlockSemaphoreInfo(file_info->semaphore); 446 446 DestroySemaphoreInfo(&file_info->semaphore); 447 447 file_info=(FileInfo *) RelinquishWizardMemory(file_info); -
WizardsToolkit/trunk/wizard/log.c
r445 r452 226 226 log_info=(LogInfo *) GetLogInfo("*",exception); 227 227 exception=DestroyExceptionInfo(exception); 228 AcquireSemaphoreInfo(&log_semaphore);228 LockSemaphoreInfo(log_semaphore); 229 229 if (log_info->file != (FILE *) NULL) 230 230 { … … 234 234 log_info->file=(FILE *) NULL; 235 235 } 236 RelinquishSemaphoreInfo(log_semaphore);236 UnlockSemaphoreInfo(log_semaphore); 237 237 } 238 238 … … 280 280 Search for named log. 281 281 */ 282 AcquireSemaphoreInfo(&log_semaphore);282 LockSemaphoreInfo(log_semaphore); 283 283 ResetLinkedListIterator(log_list); 284 284 p=(const LogInfo *) GetNextValueInLinkedList(log_list); … … 295 295 (void) InsertValueInLinkedList(log_list,0, 296 296 RemoveElementByValueFromLinkedList(log_list,p)); 297 RelinquishSemaphoreInfo(log_semaphore);297 UnlockSemaphoreInfo(log_semaphore); 298 298 return(p); 299 299 } … … 376 376 Generate log list. 377 377 */ 378 AcquireSemaphoreInfo(&log_semaphore);378 LockSemaphoreInfo(log_semaphore); 379 379 ResetLinkedListIterator(log_list); 380 380 p=(const LogInfo *) GetNextValueInLinkedList(log_list); … … 386 386 p=(const LogInfo *) GetNextValueInLinkedList(log_list); 387 387 } 388 RelinquishSemaphoreInfo(log_semaphore);388 UnlockSemaphoreInfo(log_semaphore); 389 389 qsort((void *) preferences,(size_t) i,sizeof(*preferences),LogInfoCompare); 390 390 preferences[i]=(LogInfo *) NULL; … … 469 469 Generate log list. 470 470 */ 471 AcquireSemaphoreInfo(&log_semaphore);471 LockSemaphoreInfo(log_semaphore); 472 472 ResetLinkedListIterator(log_list); 473 473 p=(const LogInfo *) GetNextValueInLinkedList(log_list); … … 479 479 p=(const LogInfo *) GetNextValueInLinkedList(log_list); 480 480 } 481 RelinquishSemaphoreInfo(log_semaphore);481 UnlockSemaphoreInfo(log_semaphore); 482 482 qsort((void *) preferences,(size_t) i,sizeof(*preferences),LogCompare); 483 483 preferences[i]=(char *) NULL; … … 536 536 { 537 537 AcquireSemaphoreInfo(&log_semaphore); 538 LockSemaphoreInfo(log_semaphore); 538 539 if ((log_list == (LinkedListInfo *) NULL) && 539 540 (instantiate_log == WizardFalse)) … … 542 543 instantiate_log=WizardTrue; 543 544 } 544 RelinquishSemaphoreInfo(log_semaphore);545 UnlockSemaphoreInfo(log_semaphore); 545 546 } 546 547 return(log_list != (LinkedListInfo *) NULL ? WizardTrue : WizardFalse); … … 687 688 WizardExport WizardBooleanType LogComponentGenesis(void) 688 689 { 689 AcquireSemaphoreInfo(&log_semaphore);690 RelinquishSemaphoreInfo(log_semaphore);690 assert(log_semaphore == (SemaphoreInfo *) NULL); 691 log_semaphore=AllocateSemaphoreInfo(); 691 692 return(WizardTrue); 692 693 } … … 741 742 WizardExport void LogComponentTerminus(void) 742 743 { 743 AcquireSemaphoreInfo(&log_semaphore); 744 if (log_semaphore == (SemaphoreInfo *) NULL) 745 AcquireSemaphoreInfo(&log_semaphore); 746 LockSemaphoreInfo(log_semaphore); 744 747 if (log_list != (LinkedListInfo *) NULL) 745 748 log_list=DestroyLinkedList(log_list,DestroyLogElement); 746 749 instantiate_log=WizardFalse; 747 RelinquishSemaphoreInfo(log_semaphore);750 UnlockSemaphoreInfo(log_semaphore); 748 751 DestroySemaphoreInfo(&log_semaphore); 749 752 } … … 1130 1133 log_info=(LogInfo *) GetLogInfo("*",exception); 1131 1134 exception=DestroyExceptionInfo(exception); 1132 AcquireSemaphoreInfo(&log_semaphore);1135 LockSemaphoreInfo(log_semaphore); 1133 1136 if ((log_info->event_mask & type) == 0) 1134 1137 { 1135 RelinquishSemaphoreInfo(log_semaphore);1138 UnlockSemaphoreInfo(log_semaphore); 1136 1139 return(WizardTrue); 1137 1140 } … … 1148 1151 { 1149 1152 (void) ContinueTimer(log_info->timer); 1150 RelinquishSemaphoreInfo(log_semaphore);1153 UnlockSemaphoreInfo(log_semaphore); 1151 1154 return(WizardFalse); 1152 1155 } … … 1191 1194 { 1192 1195 (void) ContinueTimer(log_info->timer); 1193 RelinquishSemaphoreInfo(log_semaphore);1196 UnlockSemaphoreInfo(log_semaphore); 1194 1197 return(WizardFalse); 1195 1198 } … … 1199 1202 if (log_info->file == (FILE *) NULL) 1200 1203 { 1201 RelinquishSemaphoreInfo(log_semaphore);1204 UnlockSemaphoreInfo(log_semaphore); 1202 1205 return(WizardFalse); 1203 1206 } … … 1225 1228 text=(char *) RelinquishWizardMemory(text); 1226 1229 (void) ContinueTimer(log_info->timer); 1227 RelinquishSemaphoreInfo(log_semaphore);1230 UnlockSemaphoreInfo(log_semaphore); 1228 1231 return(WizardTrue); 1229 1232 } … … 1689 1692 exception=DestroyExceptionInfo(exception); 1690 1693 option=ParseWizardOption(WizardLogEventOptions,WizardTrue,events); 1691 AcquireSemaphoreInfo(&log_semaphore);1694 LockSemaphoreInfo(log_semaphore); 1692 1695 log_info=(LogInfo *) GetValueFromLinkedList(log_list,0); 1693 1696 log_info->event_mask=(LogEventType) option; 1694 1697 if (option == -1) 1695 1698 log_info->event_mask=UndefinedEvents; 1696 RelinquishSemaphoreInfo(log_semaphore);1699 UnlockSemaphoreInfo(log_semaphore); 1697 1700 return(log_info->event_mask); 1698 1701 } … … 1731 1734 log_info=(LogInfo *) GetLogInfo("*",exception); 1732 1735 exception=DestroyExceptionInfo(exception); 1733 AcquireSemaphoreInfo(&log_semaphore);1736 LockSemaphoreInfo(log_semaphore); 1734 1737 if (log_info->format != (char *) NULL) 1735 1738 log_info->format=DestroyString(log_info->format); 1736 1739 log_info->format=ConstantString(format); 1737 RelinquishSemaphoreInfo(log_semaphore);1740 UnlockSemaphoreInfo(log_semaphore); 1738 1741 } 1739 1742 -
WizardsToolkit/trunk/wizard/memory.c
r364 r452 391 391 if (free_segments == (DataSegmentInfo *) NULL) 392 392 { 393 AcquireSemaphoreInfo(&memory_semaphore);393 LockSemaphoreInfo(memory_semaphore); 394 394 if (free_segments == (DataSegmentInfo *) NULL) 395 395 { … … 411 411 free_segments=(&memory_info.segment_pool[0]); 412 412 } 413 RelinquishSemaphoreInfo(memory_semaphore);414 } 415 AcquireSemaphoreInfo(&memory_semaphore);413 UnlockSemaphoreInfo(memory_semaphore); 414 } 415 LockSemaphoreInfo(memory_semaphore); 416 416 memory=AcquireBlock(size == 0 ? 1UL : size); 417 417 if (memory == (void *) NULL) … … 420 420 memory=AcquireBlock(size == 0 ? 1UL : size); 421 421 } 422 RelinquishSemaphoreInfo(memory_semaphore);422 UnlockSemaphoreInfo(memory_semaphore); 423 423 #endif 424 424 return(memory); … … 546 546 i; 547 547 548 AcquireSemaphoreInfo(&memory_semaphore);549 RelinquishSemaphoreInfo(memory_semaphore);548 LockSemaphoreInfo(memory_semaphore); 549 UnlockSemaphoreInfo(memory_semaphore); 550 550 for (i=0; i < (long) memory_info.number_segments; i++) 551 551 if (memory_info.segments[i]->mapped == WizardFalse) … … 742 742 assert((SizeOfBlock(memory) % (4*sizeof(size_t))) == 0); 743 743 assert((*BlockHeader(NextBlock(memory)) & PreviousBlockBit) != 0); 744 AcquireSemaphoreInfo(&memory_semaphore);744 LockSemaphoreInfo(memory_semaphore); 745 745 if ((*BlockHeader(memory) & PreviousBlockBit) == 0) 746 746 { … … 773 773 *BlockHeader(NextBlock(memory))&=(~PreviousBlockBit); 774 774 InsertFreeBlock(memory,AllocationPolicy(SizeOfBlock(memory))); 775 RelinquishSemaphoreInfo(memory_semaphore);775 UnlockSemaphoreInfo(memory_semaphore); 776 776 #endif 777 777 return((void *) NULL); … … 870 870 memory=RelinquishWizardMemory(memory); 871 871 #else 872 AcquireSemaphoreInfo(&memory_semaphore);872 LockSemaphoreInfo(memory_semaphore); 873 873 block=ResizeBlock(memory,size == 0 ? 1UL : size); 874 874 if (block == (void *) NULL) … … 876 876 if (ExpandHeap(size == 0 ? 1UL : size) == WizardFalse) 877 877 { 878 RelinquishSemaphoreInfo(memory_semaphore);878 UnlockSemaphoreInfo(memory_semaphore); 879 879 memory=RelinquishWizardMemory(memory); 880 880 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); … … 883 883 assert(block != (void *) NULL); 884 884 } 885 RelinquishSemaphoreInfo(memory_semaphore);885 UnlockSemaphoreInfo(memory_semaphore); 886 886 memory=RelinquishWizardMemory(memory); 887 887 #endif -
WizardsToolkit/trunk/wizard/mime.c
r445 r452 201 201 mime_info=(const MimeInfo *) NULL; 202 202 lsb_first=1; 203 AcquireSemaphoreInfo(&mime_semaphore);203 LockSemaphoreInfo(mime_semaphore); 204 204 ResetLinkedListIterator(mime_list); 205 205 p=(const MimeInfo *) GetNextValueInLinkedList(mime_list); … … 325 325 (void) InsertValueInLinkedList(mime_list,0, 326 326 RemoveElementByValueFromLinkedList(mime_list,p)); 327 RelinquishSemaphoreInfo(mime_semaphore);327 UnlockSemaphoreInfo(mime_semaphore); 328 328 return(mime_info); 329 329 } … … 409 409 Generate mime list. 410 410 */ 411 AcquireSemaphoreInfo(&mime_semaphore);411 LockSemaphoreInfo(mime_semaphore); 412 412 ResetLinkedListIterator(mime_list); 413 413 p=(const MimeInfo *) GetNextValueInLinkedList(mime_list); … … 419 419 p=(const MimeInfo *) GetNextValueInLinkedList(mime_list); 420 420 } 421 RelinquishSemaphoreInfo(mime_semaphore);421 UnlockSemaphoreInfo(mime_semaphore); 422 422 qsort((void *) aliases,(size_t) i,sizeof(*aliases),MimeInfoCompare); 423 423 aliases[i]=(MimeInfo *) NULL; … … 501 501 if (aliases == (char **) NULL) 502 502 return((char **) NULL); 503 AcquireSemaphoreInfo(&mime_semaphore);503 LockSemaphoreInfo(mime_semaphore); 504 504 ResetLinkedListIterator(mime_list); 505 505 p=(const MimeInfo *) GetNextValueInLinkedList(mime_list); … … 511 511 p=(const MimeInfo *) GetNextValueInLinkedList(mime_list); 512 512 } 513 RelinquishSemaphoreInfo(mime_semaphore);513 UnlockSemaphoreInfo(mime_semaphore); 514 514 qsort((void *) aliases,(size_t) i,sizeof(*aliases),MimeCompare); 515 515 aliases[i]=(char *) NULL; … … 606 606 { 607 607 AcquireSemaphoreInfo(&mime_semaphore); 608 LockSemaphoreInfo(mime_semaphore); 608 609 if ((mime_list == (LinkedListInfo *) NULL) && 609 610 (instantiate_mime == WizardFalse)) … … 612 613 instantiate_mime=WizardTrue; 613 614 } 614 RelinquishSemaphoreInfo(mime_semaphore);615 UnlockSemaphoreInfo(mime_semaphore); 615 616 } 616 617 return(mime_list != (LinkedListInfo *) NULL ? WizardTrue : WizardFalse); … … 998 999 WizardExport WizardBooleanType MimeComponentGenesis(void) 999 1000 { 1000 AcquireSemaphoreInfo(&mime_semaphore);1001 RelinquishSemaphoreInfo(mime_semaphore);1001 assert(mime_semaphore == (SemaphoreInfo *) NULL); 1002 mime_semaphore=AllocateSemaphoreInfo(); 1002 1003 return(WizardTrue); 1003 1004 } … … 1044 1045 WizardExport void MimeComponentTerminus(void) 1045 1046 { 1046 AcquireSemaphoreInfo(&mime_semaphore); 1047 if (mime_semaphore == (SemaphoreInfo *) NULL) 1048 AcquireSemaphoreInfo(&mime_semaphore); 1049 LockSemaphoreInfo(mime_semaphore); 1047 1050 if (mime_list != (LinkedListInfo *) NULL) 1048 1051 mime_list=DestroyLinkedList(mime_list,DestroyMimeElement); 1049 1052 instantiate_mime=WizardFalse; 1050 RelinquishSemaphoreInfo(mime_semaphore);1053 UnlockSemaphoreInfo(mime_semaphore); 1051 1054 DestroySemaphoreInfo(&mime_semaphore); 1052 1055 } -
WizardsToolkit/trunk/wizard/random.c
r445 r452 878 878 WizardExport WizardBooleanType RandomComponentGenesis(void) 879 879 { 880 AcquireSemaphoreInfo(&random_semaphore);881 RelinquishSemaphoreInfo(random_semaphore);880 assert(random_semaphore == (SemaphoreInfo *) NULL); 881 random_semaphore=AllocateSemaphoreInfo(); 882 882 return(WizardTrue); 883 883 } … … 903 903 WizardExport void RandomComponentTerminus(void) 904 904 { 905 AcquireSemaphoreInfo(&random_semaphore);906 RelinquishSemaphoreInfo(random_semaphore);905 if (random_semaphore == (SemaphoreInfo *) NULL) 906 AcquireSemaphoreInfo(&random_semaphore); 907 907 DestroySemaphoreInfo(&random_semaphore); 908 908 } -
WizardsToolkit/trunk/wizard/resource.c
r445 r452 320 320 return(-1); 321 321 } 322 if (resource_semaphore == (SemaphoreInfo *) NULL) 323 AcquireSemaphoreInfo(&resource_semaphore); 324 LockSemaphoreInfo(resource_semaphore); 322 325 if (temporary_resources == (SplayTreeInfo *) NULL) 323 326 temporary_resources=NewSplayTree(CompareSplayTreeString, 324 327 RelinquishWizardMemory,DestroyTemporaryResources); 328 UnlockSemaphoreInfo(resource_semaphore); 325 329 resource=ConstantString(filename); 326 330 (void) AddValueToSplayTree(temporary_resources,resource,resource); … … 371 375 status=WizardFalse; 372 376 (void) FormatWizardSize(size,resource_request); 373 AcquireSemaphoreInfo(&resource_semaphore); 377 if (resource_semaphore == (SemaphoreInfo *) NULL) 378 AcquireSemaphoreInfo(&resource_semaphore); 379 LockSemaphoreInfo(resource_semaphore); 374 380 switch (type) 375 381 { … … 378 384 resource_info.area=(WizardOffsetType) size; 379 385 limit=resource_info.area_limit; 380 status=(resource_info.area_limit == WizardResourceInfinity) || (size < limit) ?381 WizardTrue : WizardFalse;386 status=(resource_info.area_limit == WizardResourceInfinity) || 387 (size < limit) ? WizardTrue : WizardFalse; 382 388 (void) FormatWizardSize((WizardSizeType) resource_info.area, 383 389 resource_current); … … 437 443 break; 438 444 } 439 RelinquishSemaphoreInfo(resource_semaphore);445 UnlockSemaphoreInfo(resource_semaphore); 440 446 (void) LogWizardEvent(ResourceEvent,GetWizardModule(),"%s: %s/%s/%s", 441 447 WizardOptionToMnemonic(WizardResourceOptions,(long) type),resource_request, … … 513 519 514 520 resource=0; 515 AcquireSemaphoreInfo(&resource_semaphore); 521 if (resource_semaphore == (SemaphoreInfo *) NULL) 522 AcquireSemaphoreInfo(&resource_semaphore); 523 LockSemaphoreInfo(resource_semaphore); 516 524 switch (type) 517 525 { … … 544 552 break; 545 553 } 546 RelinquishSemaphoreInfo(resource_semaphore);554 UnlockSemaphoreInfo(resource_semaphore); 547 555 return(resource); 548 556 } … … 576 584 577 585 resource=0; 578 AcquireSemaphoreInfo(&resource_semaphore); 586 if (resource_semaphore == (SemaphoreInfo *) NULL) 587 AcquireSemaphoreInfo(&resource_semaphore); 588 LockSemaphoreInfo(resource_semaphore); 579 589 switch (type) 580 590 { … … 607 617 break; 608 618 } 609 RelinquishSemaphoreInfo(resource_semaphore);619 UnlockSemaphoreInfo(resource_semaphore); 610 620 return(resource); 611 621 } … … 647 657 if (file == (const FILE *) NULL) 648 658 file=stdout; 649 AcquireSemaphoreInfo(&resource_semaphore); 659 if (resource_semaphore == (SemaphoreInfo *) NULL) 660 AcquireSemaphoreInfo(&resource_semaphore); 661 LockSemaphoreInfo(resource_semaphore); 650 662 (void) FormatWizardSize(resource_info.area_limit,area_limit); 651 663 (void) FormatWizardSize(resource_info.disk_limit,disk_limit); … … 657 669 resource_info.file_limit,area_limit,memory_limit,map_limit,disk_limit); 658 670 (void) fflush(file); 659 RelinquishSemaphoreInfo(resource_semaphore);671 UnlockSemaphoreInfo(resource_semaphore); 660 672 return(WizardTrue); 661 673 } … … 695 707 696 708 (void) FormatWizardSize(size,resource_request); 697 AcquireSemaphoreInfo(&resource_semaphore); 709 if (resource_semaphore == (SemaphoreInfo *) NULL) 710 AcquireSemaphoreInfo(&resource_semaphore); 711 LockSemaphoreInfo(resource_semaphore); 698 712 switch (type) 699 713 { … … 742 756 break; 743 757 } 744 RelinquishSemaphoreInfo(resource_semaphore);758 UnlockSemaphoreInfo(resource_semaphore); 745 759 (void) LogWizardEvent(ResourceEvent,GetWizardModule(),"%s: %s/%s/%s", 746 760 WizardOptionToMnemonic(WizardResourceOptions,(long) type),resource_request, … … 841 855 Set Wizard resource limits. 842 856 */ 843 AcquireSemaphoreInfo(&resource_semaphore);844 RelinquishSemaphoreInfo(resource_semaphore);857 assert(resource_semaphore == (SemaphoreInfo *) NULL); 858 resource_semaphore=AllocateSemaphoreInfo(); 845 859 pagesize=(-1); 846 860 #if defined(WIZARDSTOOLKIT_HAVE_SYSCONF) && defined(_SC_PAGESIZE) … … 923 937 WizardExport void ResourceComponentTerminus(void) 924 938 { 925 AcquireSemaphoreInfo(&resource_semaphore); 939 if (resource_semaphore == (SemaphoreInfo *) NULL) 940 AcquireSemaphoreInfo(&resource_semaphore); 941 LockSemaphoreInfo(resource_semaphore); 926 942 if (temporary_resources != (SplayTreeInfo *) NULL) 927 943 temporary_resources=DestroySplayTree(temporary_resources); 928 RelinquishSemaphoreInfo(resource_semaphore);944 UnlockSemaphoreInfo(resource_semaphore); 929 945 DestroySemaphoreInfo(&resource_semaphore); 930 946 } … … 958 974 const WizardSizeType limit) 959 975 { 960 AcquireSemaphoreInfo(&resource_semaphore); 976 if (resource_semaphore == (SemaphoreInfo *) NULL) 977 AcquireSemaphoreInfo(&resource_semaphore); 978 LockSemaphoreInfo(resource_semaphore); 961 979 switch (type) 962 980 { … … 989 1007 break; 990 1008 } 991 RelinquishSemaphoreInfo(resource_semaphore);1009 UnlockSemaphoreInfo(resource_semaphore); 992 1010 return(WizardTrue); 993 1011 } -
WizardsToolkit/trunk/wizard/semaphore.c
r445 r452 119 119 *semaphore_info=AllocateSemaphoreInfo(); 120 120 UnlockWizardMutex(); 121 (void) LockSemaphoreInfo(*semaphore_info);122 121 } 123 122 -
WizardsToolkit/trunk/wizard/studio.h
r1 r452 402 402 #endif 403 403 404 #if !defined(PATH_MAX) 405 #define PATH_MAX 4096 406 #endif 407 404 408 /* 405 409 I/O defines. -
WizardsToolkit/trunk/wizard/wizard.c
r445 r452 41 41 #include "wizard/studio.h" 42 42 #include "wizard/client.h" 43 #include "wizard/configure.h" 43 44 #include "wizard/hash.h" 44 45 #include "wizard/log.h" … … 294 295 Initialize wizard resources. 295 296 */ 297 (void) ConfigureComponentGenesis(); 296 298 (void) ResourceComponentGenesis(); 297 299 (void) MimeComponentGenesis();
