Skip to content
nathanscottdaniels edited this page Oct 17, 2016 · 1 revision

<mutex/> Task

The mutex task wraps a section of your build script in a mutual exclusion lock. This is useful for ensuring critical sections of your script are executed by only one thread at a time.

Due to performance and potential deadlock concerns, it is recommended that use of this task be limited.

Required Attributes:

  • name: The name of the mutual exclusion lock. This is system-wide so processes outside of pNAnt can also hold the mutex. See here for more information.
  • timeout: The number of seconds to wait for the mutex to become available before failing. This is a safeguard against deadlocks and is required.

Optional Attributes:

  • if: Same as the if attrubute of other NAnt tasks.
  • unless: Same as the unless attrubute of other NAnt tasks.
  • __'failonerror__: Same as the failonerror` of other NAnt tasks.

Nested Elements

Any other task can appear within a mutex.

Example

<target name="critical">
    <mutex name="unique_name" timeout="30">
        <!-- Super mission-critical steps here -->
    </mutex>
</target>

Clone this wiki locally