<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/ExecutorJob/runSynchronously(on:)-6e565",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:12_Concurrency11ExecutorJobV16runSynchronously2onyAA011UnownedTaskB0V_tF"
  },
  "title" : "runSynchronously(on:)"
}
-->

# runSynchronously(on:)

Run this job on the passed in task executor.

```
func runSynchronously(on executor: UnownedTaskExecutor)
```

## Parameters

`executor`

the executor this job will be run on.

## Discussion

This operation runs the job on the calling thread and *blocks* until the job completes.
The intended use of this method is for an executor to determine when and where it
wants to run the job and then call this method on it.

The passed in executor reference is used to establish the executor context for the job,
and should be the same executor as the one semantically calling the `runSynchronously` method.

This operation consumes the job, preventing it accidental use after it has been run.

Converting a `ExecutorJob` to an [`UnownedJob`](/documentation/Swift/UnownedJob) and invoking ``UnownedJob/runSynchronously(_:)` on it multiple times is undefined behavior,
as a job can only ever be run once, and must not be accessed after it has been run.

> SeeAlso: ``doc://com.apple.Swift/documentation/Swift/ExecutorJob/runSynchronously(isolatedTo:taskExecutor:)``

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)