<!--
{
  "availability" : [
    "macCatalyst: -",
    "macOS: 10.6.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "OpenDirectory",
  "identifier" : "/documentation/OpenDirectory/ODQueryScheduleWithRunLoop(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Open Directory"
    ],
    "preciseIdentifier" : "c:@F@ODQueryScheduleWithRunLoop"
  },
  "title" : "ODQueryScheduleWithRunLoop(_:_:_:)"
}
-->

# ODQueryScheduleWithRunLoop(_:_:_:)

Retrieves results from a query asynchronously by scheduling the query in a run loop.

```
func ODQueryScheduleWithRunLoop(_ query: ODQueryRef!, _ runLoop: CFRunLoop!, _ runLoopMode: CFString!)
```

## Parameters

`query`

The query.

`runLoop`

The run loop.

`runLoopMode`

The mode of the run loop.

## Discussion

This function spawns a new thread to execute the query in `inRunLoop`. When the query is complete, the query’s callback function is called with both `inResults` and `inError` set to `NULL`. To remove an incomplete query from its run loop, call [`ODQueryUnscheduleFromRunLoop(_:_:_:)`](/documentation/OpenDirectory/ODQueryUnscheduleFromRunLoop(_:_:_:)).

## See Also

[`ODQueryCallback`](/documentation/OpenDirectory/ODQueryCallback)

A callback function called as results from a scheduled query are returned.



---

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)