Changeset 452

Show
Ignore:
Timestamp:
10/25/09 11:36:27 (4 weeks ago)
Author:
cristy
Message:
 
Location:
WizardsToolkit/trunk/wizard
Files:
13 modified

Legend:

Unmodified
Added
Removed
  • WizardsToolkit/trunk/wizard/blob.c

    r1 r452  
    329329      blob_info->filename); 
    330330  destroy=WizardFalse; 
    331   AcquireSemaphoreInfo(&blob_info->semaphore); 
     331  LockSemaphoreInfo(blob_info->semaphore); 
    332332  blob_info->reference_count--; 
    333333  if (blob_info->reference_count == 0) 
    334334    destroy=WizardTrue; 
    335   RelinquishSemaphoreInfo(blob_info->semaphore); 
     335  UnlockSemaphoreInfo(blob_info->semaphore); 
    336336  if (destroy == WizardFalse) 
    337337    return(blob_info); 
  • WizardsToolkit/trunk/wizard/configure.c

    r425 r452  
    7676  ConfigureMap[] = 
    7777  { 
     78    { "NAME", "ImageMagick" } 
    7879  }; 
    7980 
     
    99100%                                                                             % 
    100101%                                                                             % 
    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*/ 
     115WizardExport 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) 
    113139% 
    114140*/ 
     
    133159} 
    134160 
    135 WizardExport void DestroyConfigureList(void) 
    136 { 
    137   AcquireSemaphoreInfo(&configure_semaphore); 
     161WizardExport void ConfigureComponentTerminus(void) 
     162{ 
     163  if (configure_semaphore == (SemaphoreInfo *) NULL) 
     164    AcquireSemaphoreInfo(&configure_semaphore); 
     165  LockSemaphoreInfo(configure_semaphore); 
    138166  if (configure_list != (LinkedListInfo *) NULL) 
    139167    configure_list=DestroyLinkedList(configure_list,DestroyConfigureElement); 
    140168  configure_list=(LinkedListInfo *) NULL; 
    141169  instantiate_configure=WizardFalse; 
    142   RelinquishSemaphoreInfo(configure_semaphore); 
     170  UnlockSemaphoreInfo(configure_semaphore); 
    143171  DestroySemaphoreInfo(&configure_semaphore); 
    144172} 
     
    228256    Search for named configure. 
    229257  */ 
    230   AcquireSemaphoreInfo(&configure_semaphore); 
     258  LockSemaphoreInfo(configure_semaphore); 
    231259  ResetLinkedListIterator(configure_list); 
    232260  p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list); 
     
    243271    (void) InsertValueInLinkedList(configure_list,0, 
    244272      RemoveElementByValueFromLinkedList(configure_list,p)); 
    245   RelinquishSemaphoreInfo(configure_semaphore); 
     273  UnlockSemaphoreInfo(configure_semaphore); 
    246274  return(p); 
    247275} 
     
    327355    Generate configure list. 
    328356  */ 
    329   AcquireSemaphoreInfo(&configure_semaphore); 
     357  LockSemaphoreInfo(configure_semaphore); 
    330358  ResetLinkedListIterator(configure_list); 
    331359  p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list); 
     
    337365    p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list); 
    338366  } 
    339   RelinquishSemaphoreInfo(configure_semaphore); 
     367  UnlockSemaphoreInfo(configure_semaphore); 
    340368  qsort((void *) options,(size_t) i,sizeof(*options),ConfigureInfoCompare); 
    341369  options[i]=(ConfigureInfo *) NULL; 
     
    414442  if (p == (const ConfigureInfo *) NULL) 
    415443    return((char **) NULL); 
    416   AcquireSemaphoreInfo(&configure_semaphore); 
    417   RelinquishSemaphoreInfo(configure_semaphore); 
     444  LockSemaphoreInfo(configure_semaphore); 
     445  UnlockSemaphoreInfo(configure_semaphore); 
    418446  options=(char **) AcquireQuantumMemory((size_t) 
    419447    GetNumberOfElementsInLinkedList(configure_list)+1UL,sizeof(*options)); 
    420448  if (options == (char **) NULL) 
    421449    return((char **) NULL); 
    422   AcquireSemaphoreInfo(&configure_semaphore); 
     450  LockSemaphoreInfo(configure_semaphore); 
    423451  ResetLinkedListIterator(configure_list); 
    424452  p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list); 
     
    430458    p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list); 
    431459  } 
    432   RelinquishSemaphoreInfo(configure_semaphore); 
     460  UnlockSemaphoreInfo(configure_semaphore); 
    433461  qsort((void *) options,(size_t) i,sizeof(*options),ConfigureCompare); 
    434462  options[i]=(char *) NULL; 
     
    791819      (instantiate_configure == WizardFalse)) 
    792820    { 
    793       AcquireSemaphoreInfo(&configure_semaphore); 
     821      LockSemaphoreInfo(configure_semaphore); 
    794822      if ((configure_list == (LinkedListInfo *) NULL) && 
    795823          (instantiate_configure == WizardFalse)) 
     
    798826          instantiate_configure=WizardTrue; 
    799827        } 
    800       RelinquishSemaphoreInfo(configure_semaphore); 
     828      UnlockSemaphoreInfo(configure_semaphore); 
    801829    } 
    802830  return(configure_list != (LinkedListInfo *) NULL ? WizardTrue : WizardFalse); 
  • WizardsToolkit/trunk/wizard/configure.h

    r425 r452  
    5656 
    5757extern WizardExport WizardBooleanType 
     58  ConfigureComponentGenesis(void), 
    5859  ListConfigureInfo(FILE *,ExceptionInfo *); 
    5960 
    6061extern WizardExport void 
    61   DestroyConfigureList(void); 
     62  ConfigureComponentTerminus(void); 
    6263 
    6364#if defined(__cplusplus) || defined(c_plusplus) 
  • WizardsToolkit/trunk/wizard/exception.c

    r1 r452  
    185185  if (exception->exceptions == (void *) NULL) 
    186186    return; 
    187   AcquireSemaphoreInfo(&exception->semaphore); 
     187  LockSemaphoreInfo(exception->semaphore); 
    188188  p=(ExceptionInfo *) RemoveLastElementFromLinkedList((LinkedListInfo *) 
    189189    exception->exceptions); 
     
    197197  exception->reason=(char *) NULL; 
    198198  exception->description=(char *) NULL; 
    199   RelinquishSemaphoreInfo(exception->semaphore); 
     199  UnlockSemaphoreInfo(exception->semaphore); 
    200200  errno=0; 
    201201} 
     
    233233  if (exception->exceptions == (void *) NULL) 
    234234    return; 
    235   AcquireSemaphoreInfo(&exception->semaphore); 
     235  LockSemaphoreInfo(exception->semaphore); 
    236236  ResetLinkedListIterator((LinkedListInfo *) exception->exceptions); 
    237237  p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) 
     
    248248      exception->exceptions); 
    249249  } 
    250   RelinquishSemaphoreInfo(exception->semaphore); 
     250  UnlockSemaphoreInfo(exception->semaphore); 
    251251  ClearWizardException(exception); 
    252252} 
     
    401401  assert(exception != (ExceptionInfo *) NULL); 
    402402  assert(exception->signature == WizardSignature); 
    403   AcquireSemaphoreInfo(&exception->semaphore); 
     403  LockSemaphoreInfo(exception->semaphore); 
    404404  exception->severity=UndefinedException; 
    405405  if (exception->exceptions != (void *) NULL) 
     
    407407      exception->exceptions,DestroyExceptionElement); 
    408408  exception->signature=(~WizardSignature); 
    409   RelinquishSemaphoreInfo(exception->semaphore); 
     409  UnlockSemaphoreInfo(exception->semaphore); 
    410410  DestroySemaphoreInfo(&exception->semaphore); 
    411411  if (exception->relinquish != WizardFalse) 
     
    442442  exception->severity=UndefinedException; 
    443443  exception->exceptions=(void *) NewLinkedList(0); 
     444  exception->semaphore=AllocateSemaphoreInfo(); 
    444445  exception->signature=WizardSignature; 
    445446} 
     
    662663  if (relative->exceptions == (void *) NULL) 
    663664    return; 
    664   AcquireSemaphoreInfo(&exception->semaphore); 
     665  LockSemaphoreInfo(exception->semaphore); 
    665666  ResetLinkedListIterator((LinkedListInfo *) relative->exceptions); 
    666667  p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) 
     
    672673      relative->exceptions); 
    673674  } 
    674   RelinquishSemaphoreInfo(exception->semaphore); 
     675  UnlockSemaphoreInfo(exception->semaphore); 
    675676} 
    676677 
  • WizardsToolkit/trunk/wizard/file.c

    r1 r452  
    147147  assert(file_info->signature == WizardSignature); 
    148148  (void) LogWizardEvent(TraceEvent,GetWizardModule(),"%s",file_info->path); 
    149   AcquireSemaphoreInfo(&file_info->semaphore); 
     149  LockSemaphoreInfo(file_info->semaphore); 
    150150  path=AcquireString(file_info->path); 
    151151  AppendFileExtension("lck",path); 
     
    176176              { 
    177177                path=DestroyString(path); 
    178                 RelinquishSemaphoreInfo(file_info->semaphore); 
     178                UnlockSemaphoreInfo(file_info->semaphore); 
    179179                return(WizardTrue); 
    180180              } 
     
    220220  } 
    221221  path=DestroyString(path); 
    222   RelinquishSemaphoreInfo(file_info->semaphore); 
     222  UnlockSemaphoreInfo(file_info->semaphore); 
    223223  return(WizardFalse); 
    224224} 
     
    278278  file_info->path=AcquireString((char *) NULL); 
    279279  file_info->file=(-1); 
    280   file_info->semaphore=(SemaphoreInfo *) NULL; 
     280  file_info->semaphore=AllocateSemaphoreInfo(); 
    281281  file_info->timestamp=time((time_t *) NULL); 
    282282  file_info->signature=WizardSignature; 
     
    433433  assert(file_info->signature == WizardSignature); 
    434434  (void) LogWizardEvent(TraceEvent,GetWizardModule(),"%s",file_info->path); 
    435   AcquireSemaphoreInfo(&file_info->semaphore); 
     435  LockSemaphoreInfo(file_info->semaphore); 
    436436  if (file_info->file >= 0) 
    437437    if (close(file_info->file) == -1) 
     
    443443    file_info->path=DestroyString(file_info->path); 
    444444  file_info->signature=(~WizardSignature); 
    445   RelinquishSemaphoreInfo(file_info->semaphore); 
     445  UnlockSemaphoreInfo(file_info->semaphore); 
    446446  DestroySemaphoreInfo(&file_info->semaphore); 
    447447  file_info=(FileInfo *) RelinquishWizardMemory(file_info); 
  • WizardsToolkit/trunk/wizard/log.c

    r445 r452  
    226226  log_info=(LogInfo *) GetLogInfo("*",exception); 
    227227  exception=DestroyExceptionInfo(exception); 
    228   AcquireSemaphoreInfo(&log_semaphore); 
     228  LockSemaphoreInfo(log_semaphore); 
    229229  if (log_info->file != (FILE *) NULL) 
    230230    { 
     
    234234      log_info->file=(FILE *) NULL; 
    235235    } 
    236   RelinquishSemaphoreInfo(log_semaphore); 
     236  UnlockSemaphoreInfo(log_semaphore); 
    237237} 
    238238 
     
    280280    Search for named log. 
    281281  */ 
    282   AcquireSemaphoreInfo(&log_semaphore); 
     282  LockSemaphoreInfo(log_semaphore); 
    283283  ResetLinkedListIterator(log_list); 
    284284  p=(const LogInfo *) GetNextValueInLinkedList(log_list); 
     
    295295    (void) InsertValueInLinkedList(log_list,0, 
    296296      RemoveElementByValueFromLinkedList(log_list,p)); 
    297   RelinquishSemaphoreInfo(log_semaphore); 
     297  UnlockSemaphoreInfo(log_semaphore); 
    298298  return(p); 
    299299} 
     
    376376    Generate log list. 
    377377  */ 
    378   AcquireSemaphoreInfo(&log_semaphore); 
     378  LockSemaphoreInfo(log_semaphore); 
    379379  ResetLinkedListIterator(log_list); 
    380380  p=(const LogInfo *) GetNextValueInLinkedList(log_list); 
     
    386386    p=(const LogInfo *) GetNextValueInLinkedList(log_list); 
    387387  } 
    388   RelinquishSemaphoreInfo(log_semaphore); 
     388  UnlockSemaphoreInfo(log_semaphore); 
    389389  qsort((void *) preferences,(size_t) i,sizeof(*preferences),LogInfoCompare); 
    390390  preferences[i]=(LogInfo *) NULL; 
     
    469469    Generate log list. 
    470470  */ 
    471   AcquireSemaphoreInfo(&log_semaphore); 
     471  LockSemaphoreInfo(log_semaphore); 
    472472  ResetLinkedListIterator(log_list); 
    473473  p=(const LogInfo *) GetNextValueInLinkedList(log_list); 
     
    479479    p=(const LogInfo *) GetNextValueInLinkedList(log_list); 
    480480  } 
    481   RelinquishSemaphoreInfo(log_semaphore); 
     481  UnlockSemaphoreInfo(log_semaphore); 
    482482  qsort((void *) preferences,(size_t) i,sizeof(*preferences),LogCompare); 
    483483  preferences[i]=(char *) NULL; 
     
    536536    { 
    537537      AcquireSemaphoreInfo(&log_semaphore); 
     538      LockSemaphoreInfo(log_semaphore); 
    538539      if ((log_list == (LinkedListInfo *) NULL) && 
    539540          (instantiate_log == WizardFalse)) 
     
    542543          instantiate_log=WizardTrue; 
    543544        } 
    544       RelinquishSemaphoreInfo(log_semaphore); 
     545      UnlockSemaphoreInfo(log_semaphore); 
    545546    } 
    546547  return(log_list != (LinkedListInfo *) NULL ? WizardTrue : WizardFalse); 
     
    687688WizardExport WizardBooleanType LogComponentGenesis(void) 
    688689{ 
    689   AcquireSemaphoreInfo(&log_semaphore); 
    690   RelinquishSemaphoreInfo(log_semaphore); 
     690  assert(log_semaphore == (SemaphoreInfo *) NULL); 
     691  log_semaphore=AllocateSemaphoreInfo(); 
    691692  return(WizardTrue); 
    692693} 
     
    741742WizardExport void LogComponentTerminus(void) 
    742743{ 
    743   AcquireSemaphoreInfo(&log_semaphore); 
     744  if (log_semaphore == (SemaphoreInfo *) NULL) 
     745    AcquireSemaphoreInfo(&log_semaphore); 
     746  LockSemaphoreInfo(log_semaphore); 
    744747  if (log_list != (LinkedListInfo *) NULL) 
    745748    log_list=DestroyLinkedList(log_list,DestroyLogElement); 
    746749  instantiate_log=WizardFalse; 
    747   RelinquishSemaphoreInfo(log_semaphore); 
     750  UnlockSemaphoreInfo(log_semaphore); 
    748751  DestroySemaphoreInfo(&log_semaphore); 
    749752} 
     
    11301133  log_info=(LogInfo *) GetLogInfo("*",exception); 
    11311134  exception=DestroyExceptionInfo(exception); 
    1132   AcquireSemaphoreInfo(&log_semaphore); 
     1135  LockSemaphoreInfo(log_semaphore); 
    11331136  if ((log_info->event_mask & type) == 0) 
    11341137    { 
    1135       RelinquishSemaphoreInfo(log_semaphore); 
     1138      UnlockSemaphoreInfo(log_semaphore); 
    11361139      return(WizardTrue); 
    11371140    } 
     
    11481151    { 
    11491152      (void) ContinueTimer(log_info->timer); 
    1150       RelinquishSemaphoreInfo(log_semaphore); 
     1153      UnlockSemaphoreInfo(log_semaphore); 
    11511154      return(WizardFalse); 
    11521155    } 
     
    11911194            { 
    11921195              (void) ContinueTimer(log_info->timer); 
    1193               RelinquishSemaphoreInfo(log_semaphore); 
     1196              UnlockSemaphoreInfo(log_semaphore); 
    11941197              return(WizardFalse); 
    11951198            } 
     
    11991202          if (log_info->file == (FILE *) NULL) 
    12001203            { 
    1201               RelinquishSemaphoreInfo(log_semaphore); 
     1204              UnlockSemaphoreInfo(log_semaphore); 
    12021205              return(WizardFalse); 
    12031206            } 
     
    12251228  text=(char  *) RelinquishWizardMemory(text); 
    12261229  (void) ContinueTimer(log_info->timer); 
    1227   RelinquishSemaphoreInfo(log_semaphore); 
     1230  UnlockSemaphoreInfo(log_semaphore); 
    12281231  return(WizardTrue); 
    12291232} 
     
    16891692  exception=DestroyExceptionInfo(exception); 
    16901693  option=ParseWizardOption(WizardLogEventOptions,WizardTrue,events); 
    1691   AcquireSemaphoreInfo(&log_semaphore); 
     1694  LockSemaphoreInfo(log_semaphore); 
    16921695  log_info=(LogInfo *) GetValueFromLinkedList(log_list,0); 
    16931696  log_info->event_mask=(LogEventType) option; 
    16941697  if (option == -1) 
    16951698    log_info->event_mask=UndefinedEvents; 
    1696   RelinquishSemaphoreInfo(log_semaphore); 
     1699  UnlockSemaphoreInfo(log_semaphore); 
    16971700  return(log_info->event_mask); 
    16981701} 
     
    17311734  log_info=(LogInfo *) GetLogInfo("*",exception); 
    17321735  exception=DestroyExceptionInfo(exception); 
    1733   AcquireSemaphoreInfo(&log_semaphore); 
     1736  LockSemaphoreInfo(log_semaphore); 
    17341737  if (log_info->format != (char *) NULL) 
    17351738    log_info->format=DestroyString(log_info->format); 
    17361739  log_info->format=ConstantString(format); 
    1737   RelinquishSemaphoreInfo(log_semaphore); 
     1740  UnlockSemaphoreInfo(log_semaphore); 
    17381741} 
    17391742 
  • WizardsToolkit/trunk/wizard/memory.c

    r364 r452  
    391391  if (free_segments == (DataSegmentInfo *) NULL) 
    392392    { 
    393       AcquireSemaphoreInfo(&memory_semaphore); 
     393      LockSemaphoreInfo(memory_semaphore); 
    394394      if (free_segments == (DataSegmentInfo *) NULL) 
    395395        { 
     
    411411          free_segments=(&memory_info.segment_pool[0]); 
    412412        } 
    413       RelinquishSemaphoreInfo(memory_semaphore); 
    414     } 
    415   AcquireSemaphoreInfo(&memory_semaphore); 
     413      UnlockSemaphoreInfo(memory_semaphore); 
     414    } 
     415  LockSemaphoreInfo(memory_semaphore); 
    416416  memory=AcquireBlock(size == 0 ? 1UL : size); 
    417417  if (memory == (void *) NULL) 
     
    420420        memory=AcquireBlock(size == 0 ? 1UL : size); 
    421421    } 
    422   RelinquishSemaphoreInfo(memory_semaphore); 
     422  UnlockSemaphoreInfo(memory_semaphore); 
    423423#endif 
    424424  return(memory); 
     
    546546    i; 
    547547 
    548   AcquireSemaphoreInfo(&memory_semaphore); 
    549   RelinquishSemaphoreInfo(memory_semaphore); 
     548  LockSemaphoreInfo(memory_semaphore); 
     549  UnlockSemaphoreInfo(memory_semaphore); 
    550550  for (i=0; i < (long) memory_info.number_segments; i++) 
    551551    if (memory_info.segments[i]->mapped == WizardFalse) 
     
    742742  assert((SizeOfBlock(memory) % (4*sizeof(size_t))) == 0); 
    743743  assert((*BlockHeader(NextBlock(memory)) & PreviousBlockBit) != 0); 
    744   AcquireSemaphoreInfo(&memory_semaphore); 
     744  LockSemaphoreInfo(memory_semaphore); 
    745745  if ((*BlockHeader(memory) & PreviousBlockBit) == 0) 
    746746    { 
     
    773773  *BlockHeader(NextBlock(memory))&=(~PreviousBlockBit); 
    774774  InsertFreeBlock(memory,AllocationPolicy(SizeOfBlock(memory))); 
    775   RelinquishSemaphoreInfo(memory_semaphore); 
     775  UnlockSemaphoreInfo(memory_semaphore); 
    776776#endif 
    777777  return((void *) NULL); 
     
    870870    memory=RelinquishWizardMemory(memory); 
    871871#else 
    872   AcquireSemaphoreInfo(&memory_semaphore); 
     872  LockSemaphoreInfo(memory_semaphore); 
    873873  block=ResizeBlock(memory,size == 0 ? 1UL : size); 
    874874  if (block == (void *) NULL) 
     
    876876      if (ExpandHeap(size == 0 ? 1UL : size) == WizardFalse) 
    877877        { 
    878           RelinquishSemaphoreInfo(memory_semaphore); 
     878          UnlockSemaphoreInfo(memory_semaphore); 
    879879          memory=RelinquishWizardMemory(memory); 
    880880          ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); 
     
    883883      assert(block != (void *) NULL); 
    884884    } 
    885   RelinquishSemaphoreInfo(memory_semaphore); 
     885  UnlockSemaphoreInfo(memory_semaphore); 
    886886  memory=RelinquishWizardMemory(memory); 
    887887#endif 
  • WizardsToolkit/trunk/wizard/mime.c

    r445 r452  
    201201  mime_info=(const MimeInfo *) NULL; 
    202202  lsb_first=1; 
    203   AcquireSemaphoreInfo(&mime_semaphore); 
     203  LockSemaphoreInfo(mime_semaphore); 
    204204  ResetLinkedListIterator(mime_list); 
    205205  p=(const MimeInfo *) GetNextValueInLinkedList(mime_list); 
     
    325325    (void) InsertValueInLinkedList(mime_list,0, 
    326326      RemoveElementByValueFromLinkedList(mime_list,p)); 
    327   RelinquishSemaphoreInfo(mime_semaphore); 
     327  UnlockSemaphoreInfo(mime_semaphore); 
    328328  return(mime_info); 
    329329} 
     
    409409    Generate mime list. 
    410410  */ 
    411   AcquireSemaphoreInfo(&mime_semaphore); 
     411  LockSemaphoreInfo(mime_semaphore); 
    412412  ResetLinkedListIterator(mime_list); 
    413413  p=(const MimeInfo *) GetNextValueInLinkedList(mime_list); 
     
    419419    p=(const MimeInfo *) GetNextValueInLinkedList(mime_list); 
    420420  } 
    421   RelinquishSemaphoreInfo(mime_semaphore); 
     421  UnlockSemaphoreInfo(mime_semaphore); 
    422422  qsort((void *) aliases,(size_t) i,sizeof(*aliases),MimeInfoCompare); 
    423423  aliases[i]=(MimeInfo *) NULL; 
     
    501501  if (aliases == (char **) NULL) 
    502502    return((char **) NULL); 
    503   AcquireSemaphoreInfo(&mime_semaphore); 
     503  LockSemaphoreInfo(mime_semaphore); 
    504504  ResetLinkedListIterator(mime_list); 
    505505  p=(const MimeInfo *) GetNextValueInLinkedList(mime_list); 
     
    511511    p=(const MimeInfo *) GetNextValueInLinkedList(mime_list); 
    512512  } 
    513   RelinquishSemaphoreInfo(mime_semaphore); 
     513  UnlockSemaphoreInfo(mime_semaphore); 
    514514  qsort((void *) aliases,(size_t) i,sizeof(*aliases),MimeCompare); 
    515515  aliases[i]=(char *) NULL; 
     
    606606    { 
    607607      AcquireSemaphoreInfo(&mime_semaphore); 
     608      LockSemaphoreInfo(mime_semaphore); 
    608609      if ((mime_list == (LinkedListInfo *) NULL) && 
    609610          (instantiate_mime == WizardFalse)) 
     
    612613          instantiate_mime=WizardTrue; 
    613614        } 
    614       RelinquishSemaphoreInfo(mime_semaphore); 
     615      UnlockSemaphoreInfo(mime_semaphore); 
    615616    } 
    616617  return(mime_list != (LinkedListInfo *) NULL ? WizardTrue : WizardFalse); 
     
    998999WizardExport WizardBooleanType MimeComponentGenesis(void) 
    9991000{ 
    1000   AcquireSemaphoreInfo(&mime_semaphore); 
    1001   RelinquishSemaphoreInfo(mime_semaphore); 
     1001  assert(mime_semaphore == (SemaphoreInfo *) NULL); 
     1002  mime_semaphore=AllocateSemaphoreInfo(); 
    10021003  return(WizardTrue); 
    10031004} 
     
    10441045WizardExport void MimeComponentTerminus(void) 
    10451046{ 
    1046   AcquireSemaphoreInfo(&mime_semaphore); 
     1047  if (mime_semaphore == (SemaphoreInfo *) NULL) 
     1048    AcquireSemaphoreInfo(&mime_semaphore); 
     1049  LockSemaphoreInfo(mime_semaphore); 
    10471050  if (mime_list != (LinkedListInfo *) NULL) 
    10481051    mime_list=DestroyLinkedList(mime_list,DestroyMimeElement); 
    10491052  instantiate_mime=WizardFalse; 
    1050   RelinquishSemaphoreInfo(mime_semaphore); 
     1053  UnlockSemaphoreInfo(mime_semaphore); 
    10511054  DestroySemaphoreInfo(&mime_semaphore); 
    10521055} 
  • WizardsToolkit/trunk/wizard/random.c

    r445 r452  
    878878WizardExport WizardBooleanType RandomComponentGenesis(void) 
    879879{ 
    880   AcquireSemaphoreInfo(&random_semaphore); 
    881   RelinquishSemaphoreInfo(random_semaphore); 
     880  assert(random_semaphore == (SemaphoreInfo *) NULL); 
     881  random_semaphore=AllocateSemaphoreInfo(); 
    882882  return(WizardTrue); 
    883883} 
     
    903903WizardExport void RandomComponentTerminus(void) 
    904904{ 
    905   AcquireSemaphoreInfo(&random_semaphore); 
    906   RelinquishSemaphoreInfo(random_semaphore); 
     905  if (random_semaphore == (SemaphoreInfo *) NULL) 
     906    AcquireSemaphoreInfo(&random_semaphore); 
    907907  DestroySemaphoreInfo(&random_semaphore); 
    908908} 
  • WizardsToolkit/trunk/wizard/resource.c

    r445 r452  
    320320      return(-1); 
    321321    } 
     322  if (resource_semaphore == (SemaphoreInfo *) NULL) 
     323    AcquireSemaphoreInfo(&resource_semaphore); 
     324  LockSemaphoreInfo(resource_semaphore); 
    322325  if (temporary_resources == (SplayTreeInfo *) NULL) 
    323326    temporary_resources=NewSplayTree(CompareSplayTreeString, 
    324327      RelinquishWizardMemory,DestroyTemporaryResources); 
     328  UnlockSemaphoreInfo(resource_semaphore); 
    325329  resource=ConstantString(filename); 
    326330  (void) AddValueToSplayTree(temporary_resources,resource,resource); 
     
    371375  status=WizardFalse; 
    372376  (void) FormatWizardSize(size,resource_request); 
    373   AcquireSemaphoreInfo(&resource_semaphore); 
     377  if (resource_semaphore == (SemaphoreInfo *) NULL) 
     378    AcquireSemaphoreInfo(&resource_semaphore); 
     379  LockSemaphoreInfo(resource_semaphore); 
    374380  switch (type) 
    375381  { 
     
    378384      resource_info.area=(WizardOffsetType) size; 
    379385      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; 
    382388      (void) FormatWizardSize((WizardSizeType) resource_info.area, 
    383389        resource_current); 
     
    437443      break; 
    438444  } 
    439   RelinquishSemaphoreInfo(resource_semaphore); 
     445  UnlockSemaphoreInfo(resource_semaphore); 
    440446  (void) LogWizardEvent(ResourceEvent,GetWizardModule(),"%s: %s/%s/%s", 
    441447    WizardOptionToMnemonic(WizardResourceOptions,(long) type),resource_request, 
     
    513519 
    514520  resource=0; 
    515   AcquireSemaphoreInfo(&resource_semaphore); 
     521  if (resource_semaphore == (SemaphoreInfo *) NULL) 
     522    AcquireSemaphoreInfo(&resource_semaphore); 
     523  LockSemaphoreInfo(resource_semaphore); 
    516524  switch (type) 
    517525  { 
     
    544552      break; 
    545553  } 
    546   RelinquishSemaphoreInfo(resource_semaphore); 
     554  UnlockSemaphoreInfo(resource_semaphore); 
    547555  return(resource); 
    548556} 
     
    576584 
    577585  resource=0; 
    578   AcquireSemaphoreInfo(&resource_semaphore); 
     586  if (resource_semaphore == (SemaphoreInfo *) NULL) 
     587    AcquireSemaphoreInfo(&resource_semaphore); 
     588  LockSemaphoreInfo(resource_semaphore); 
    579589  switch (type) 
    580590  { 
     
    607617      break; 
    608618  } 
    609   RelinquishSemaphoreInfo(resource_semaphore); 
     619  UnlockSemaphoreInfo(resource_semaphore); 
    610620  return(resource); 
    611621} 
     
    647657  if (file == (const FILE *) NULL) 
    648658    file=stdout; 
    649   AcquireSemaphoreInfo(&resource_semaphore); 
     659  if (resource_semaphore == (SemaphoreInfo *) NULL) 
     660    AcquireSemaphoreInfo(&resource_semaphore); 
     661  LockSemaphoreInfo(resource_semaphore); 
    650662  (void) FormatWizardSize(resource_info.area_limit,area_limit); 
    651663  (void) FormatWizardSize(resource_info.disk_limit,disk_limit); 
     
    657669    resource_info.file_limit,area_limit,memory_limit,map_limit,disk_limit); 
    658670  (void) fflush(file); 
    659   RelinquishSemaphoreInfo(resource_semaphore); 
     671  UnlockSemaphoreInfo(resource_semaphore); 
    660672  return(WizardTrue); 
    661673} 
     
    695707 
    696708  (void) FormatWizardSize(size,resource_request); 
    697   AcquireSemaphoreInfo(&resource_semaphore); 
     709  if (resource_semaphore == (SemaphoreInfo *) NULL) 
     710    AcquireSemaphoreInfo(&resource_semaphore); 
     711  LockSemaphoreInfo(resource_semaphore); 
    698712  switch (type) 
    699713  { 
     
    742756      break; 
    743757  } 
    744   RelinquishSemaphoreInfo(resource_semaphore); 
     758  UnlockSemaphoreInfo(resource_semaphore); 
    745759  (void) LogWizardEvent(ResourceEvent,GetWizardModule(),"%s: %s/%s/%s", 
    746760    WizardOptionToMnemonic(WizardResourceOptions,(long) type),resource_request, 
     
    841855    Set Wizard resource limits. 
    842856  */ 
    843   AcquireSemaphoreInfo(&resource_semaphore); 
    844   RelinquishSemaphoreInfo(resource_semaphore); 
     857  assert(resource_semaphore == (SemaphoreInfo *) NULL); 
     858  resource_semaphore=AllocateSemaphoreInfo(); 
    845859  pagesize=(-1); 
    846860#if defined(WIZARDSTOOLKIT_HAVE_SYSCONF) && defined(_SC_PAGESIZE) 
     
    923937WizardExport void ResourceComponentTerminus(void) 
    924938{ 
    925   AcquireSemaphoreInfo(&resource_semaphore); 
     939  if (resource_semaphore == (SemaphoreInfo *) NULL) 
     940    AcquireSemaphoreInfo(&resource_semaphore); 
     941  LockSemaphoreInfo(resource_semaphore); 
    926942  if (temporary_resources != (SplayTreeInfo *) NULL) 
    927943    temporary_resources=DestroySplayTree(temporary_resources); 
    928   RelinquishSemaphoreInfo(resource_semaphore); 
     944  UnlockSemaphoreInfo(resource_semaphore); 
    929945  DestroySemaphoreInfo(&resource_semaphore); 
    930946} 
     
    958974  const WizardSizeType limit) 
    959975{ 
    960   AcquireSemaphoreInfo(&resource_semaphore); 
     976  if (resource_semaphore == (SemaphoreInfo *) NULL) 
     977    AcquireSemaphoreInfo(&resource_semaphore); 
     978  LockSemaphoreInfo(resource_semaphore); 
    961979  switch (type) 
    962980  { 
     
    9891007      break; 
    9901008  } 
    991   RelinquishSemaphoreInfo(resource_semaphore); 
     1009  UnlockSemaphoreInfo(resource_semaphore); 
    9921010  return(WizardTrue); 
    9931011} 
  • WizardsToolkit/trunk/wizard/semaphore.c

    r445 r452  
    119119    *semaphore_info=AllocateSemaphoreInfo(); 
    120120  UnlockWizardMutex(); 
    121   (void) LockSemaphoreInfo(*semaphore_info); 
    122121} 
    123122 
  • WizardsToolkit/trunk/wizard/studio.h

    r1 r452  
    402402#endif 
    403403 
     404#if !defined(PATH_MAX) 
     405#define PATH_MAX  4096 
     406#endif 
     407 
    404408/* 
    405409  I/O defines. 
  • WizardsToolkit/trunk/wizard/wizard.c

    r445 r452  
    4141#include "wizard/studio.h" 
    4242#include "wizard/client.h" 
     43#include "wizard/configure.h" 
    4344#include "wizard/hash.h" 
    4445#include "wizard/log.h" 
     
    294295    Initialize wizard resources. 
    295296  */ 
     297  (void) ConfigureComponentGenesis(); 
    296298  (void) ResourceComponentGenesis(); 
    297299  (void) MimeComponentGenesis();