<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Change SYSTEM "https://itk.org/migrationv4/ITKMigration.dtd">
<!--**
**
** RemoveditkSemaphore.xml
**
**
**-->
<Change>
    <!--**
    ** Title for the online migration page
    **-->
    <Title>
      Removed itkSemaphore
    </Title>

    <!--**
    ** The author of the change
    **-->
    <Author>
      Bradley Lowekamp
    </Author>

    <!--**
    ** Date of creation for the XML document
    **-->
    <Date>
      2011-02-19
    </Date>

    <!--**
    ** Plain text description of the change
    ** Extracted from git commit messages
    **-->
    <Description>
      itk::Semaphore has been removed and placed in the deprecated module.

      The implementation contained a mixture of thread semaphores and
      inter-process semaphores. This gives vastly different
      performance characteristics across platforms.

      While you can simple continue using the old class, it is
      strongly recommended to update to use mutexes and conditional
      variables. By doing so you have the potential to take advantage
      of ITKv4 improved threading model.

      ENH: removes semaphore in favor of mutex and conditional
      This was the only class in ITK which utilized a semaphore. This was
      replaced with the equivalent mutex and conditioanl variable.

    </Description>

    <!--**
    ** Sample code snippets
    ** Extracted from git diff of changed files in Examples and Testing
    **-->
    <SampleCode>
      <Old>
        itk::Semaphore::Pointer m_Semaphore = itk::Semaphore::New();

        m_Semaphore->Up();

        m_Semaphore->Down()
      </Old>

      <New>
        <![CDATA[
        int m_Semaphore;
        SimpleMutexLock m_Lockl
        ConditionalVariable::Pointer m_Condition = ConditionalVariable::New();

        m_Lock.Lock();
        ++m_Semaphore;
        m_Condition->Signal();
        m_Lock.Unlock();

        m_Lock.Lock();
        if ( m_Semaphore == 0 )
        {
        m_Condition->Wait( & td.m_Lock);
        }
        --m_Semaphore;
        m_Lock.Unlock();
        ]]>
      </New>

    </SampleCode>

    <!--**
    ** The change-ids for all commits in the topic branch
    **-->
    <Gerrit-ChangeId>
      I5afecd8f29b07beed97534731e677214d1cceb3b
      I175f87493476d473a38f20f837479a7fe882230a
    </Gerrit-ChangeId>

    <!--**
    ** List of all changed files from the topic branch
    **-->
    <FileList>
      Code/Common/CMakeLists.txt
      Code/Common/itkSemaphore.cxx
      Code/Common/itkSemaphore.h
      Code/Common/itkSemaphoreNoThreads.cxx
      Code/Common/itkSemaphorePThreads.cxx
      Code/Common/itkSemaphoreWinThreads.cxx
      Testing/Code/Common/CMakeLists.txt
      Testing/Code/Common/itkCommonHeaderTest.cxx
      Testing/Code/Common/itkSemaphoreTest.cxx
      Code/BasicFilters/itkParallelSparseFieldLevelSetImageFilter.h
      Code/BasicFilters/itkParallelSparseFieldLevelSetImageFilter.txx
    </FileList>

    <!--**
    ** If the migration can be accomplished by a simple string
    ** substitution, then use the following construct to define
    ** the substitution rule.
    **
    ** <MigrationFix-Automatic>
    **   <Old>
    **     MipsleledName
    **   </Old>
    **   <New>
    **     MisspelledName
    **   </New>
    ** </MigrationFix-Automatic>
    **-->

    <!--**
    ** If the migration can NOT be accomplished by a simple string
    ** substitution, but potential problem spots can be identified,
    ** use the following construct to define a migration flag rule.
    **
    ** <MigrationFix-Manual>
    **   OldFunctionName
    ** </MigrationFix-Manual>
    **-->

</Change>
