Question: I have a requirement where i want to skip all the upcoming tasks if a "Release artifacts" task is run. Release artifact task runs only if one of the variable is set to "true" while running the pipeline.

```
parameters:
  release: $(release)

- task: Bash@3
    displayName: Release artifacts
    condition: and(succeeded(), eq('${{ parameters.release }}', true))
    inputs:
        targetType: 'inline'
        script: |
            # Write your commands here
            # Steps to release the artifacts ( gradle release plugin)
            gradle release -Prelease.useAutomaticVersion=true

- task: Bash@3

- task: Bash@3

```

Is there a way to exit/truncate the pipeline with exit code 0 ? I am looking for a functionality to skip all the upcoming tasks if one of the conditions is true without having to add that check in all the tasks ?

Reason : gradle release will make modification to gradle.properties which will trigger CI again.

Answer: 
You may have a race condition which may cause undefined behavior. In create\_serv\_and\_init\_client() you define a local variable serv. The address of this variable is passed to the thread. When create\_serv\_and\_init\_client completes serv will go out of scope, even if the thread is still using it. As a result the value of serv may no longer be correct.
Note a multi-threaded program can really only `fork` to execute a new program using `execve`. For example from Linux manuals:

> 
> * After a `fork()` in a multithreaded program, the child can safely call only async-signal-safe functions (see signal-safety(7)) until such time as it calls `execve(2)`.
> 
> 
> 

`printf` for example can lock the `stdout`. If you happen to fork in while the `printf` lock is held by another thread then crazy things might or might not happen.