<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFRunLoopSourceGetContext(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@F@CFRunLoopSourceGetContext"
  },
  "title" : "CFRunLoopSourceGetContext(_:_:)"
}
-->

# CFRunLoopSourceGetContext(_:_:)

Returns the context information for a CFRunLoopSource object.

```
func CFRunLoopSourceGetContext(_ source: CFRunLoopSource!, _ context: UnsafeMutablePointer<CFRunLoopSourceContext>!)
```

## Parameters

`source`

The run loop source to examine.

`context`

A pointer to the structure into which the context information for `source` is to be copied. The information being returned is the same information passed to [`CFRunLoopSourceCreate(_:_:_:)`](/documentation/CoreFoundation/CFRunLoopSourceCreate(_:_:_:)) when creating `source`.

## Discussion

Run loop sources come in two versions with different-sized context structures. `context` must point to the correct version of the structure for `source`. Before calling this function, you need to initialize the `version` member of `context` with the version number (either 0 or 1) of `source`.

---

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)