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

# CFRunLoopAddSource(_:_:_:)

Adds a CFRunLoopSource object to a run loop mode.

```
func CFRunLoopAddSource(_ rl: CFRunLoop!, _ source: CFRunLoopSource!, _ mode: CFRunLoopMode!)
```

## Parameters

`rl`

The run loop to modify.

`source`

The run loop source to add. The source is retained by the run loop.

`mode`

The run loop mode to which to add `source`. Use the constant [`commonModes`](/documentation/CoreFoundation/CFRunLoopMode/commonModes) to add `source` to the set of objects monitored by all the common modes.

## Discussion

If `source` is a version 0 source, this function calls the `schedule` callback function specified in the context structure for `source`. See [`CFRunLoopSourceContext`](/documentation/CoreFoundation/CFRunLoopSourceContext) for more details.

A run loop source can be registered in multiple run loops and run loop modes at the same time. When the source is signaled, whichever run loop that happens to detect the signal first will fire the source.

If `rl` already contains `source` in `mode`, this function does nothing.

---

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)