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

# CFFileDescriptorCreateRunLoopSource(_:_:_:)

Creates a new runloop source for a given CFFileDescriptor.

```
func CFFileDescriptorCreateRunLoopSource(_ allocator: CFAllocator!, _ f: CFFileDescriptor!, _ order: CFIndex) -> CFRunLoopSource!
```

## Parameters

`allocator`

The allocator to use to allocate memory for the new bag and its storage for values. Pass `NULL` or kCFAllocatorDefault to use the current default allocator.

`f`

A CFFileDescriptor.

`order`

The order for the new run loop (see [`CFRunLoopSourceCreate(_:_:_:)`](/documentation/CoreFoundation/CFRunLoopSourceCreate(_:_:_:))).

## Return Value

A new runloop source for `f`, or `NULL` if there was a problem creating the object. Ownership follows the [The Create Rule](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-103029).

## Discussion

The context for the new runloop (see [`CFRunLoopSourceCreate(_:_:_:)`](/documentation/CoreFoundation/CFRunLoopSourceCreate(_:_:_:))) is the same as the context passed in when the CFFileDescriptor was created (see [`CFFileDescriptorCreate(_:_:_:_:_:)`](/documentation/CoreFoundation/CFFileDescriptorCreate(_:_:_:_:_:))).

---

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)