---
title: "CFMessagePortCreateRunLoopSource(_:_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfmessageportcreaterunloopsource(_:_:_:)"
---

# CFMessagePortCreateRunLoopSource(_:_:_:)

Creates a CFRunLoopSource object for a CFMessagePort object.

## Declaration

```swift
func CFMessagePortCreateRunLoopSource(_ allocator: CFAllocator!, _ local: CFMessagePort!, _ order: CFIndex) -> CFRunLoopSource!
```

## Parameters

- `allocator`: The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.
- `local`: The message port for which to create a run loop source.
- `order`: A priority index indicating the order in which run loop sources are processed. order is currently ignored by CFMessagePort object run loop sources. Pass 0 for this value.

## Return Value

Return Value The new CFRunLoopSource object for ms. Ownership follows the The Create Rule.

## Discussion

Discussion The run loop source is not automatically added to a run loop. To add the source to a run loop, use CFRunLoopAddSource(_:_:_:). Special Considerations This method is not available on iOS 7 and later—it will return NULL and log a sandbox violation in syslog. See Concurrency Programming Guide for possible replacement technologies.

## See Also

### Configuring a CFMessagePort Object

- [CFMessagePortSetInvalidationCallBack(_:_:)](corefoundation/cfmessageportsetinvalidationcallback(_:_:).md)
- [CFMessagePortSetName(_:_:)](corefoundation/cfmessageportsetname(_:_:).md)
