apple/swift-corelibs-libdispatch logo

apple/swift-corelibs-libdispatch

Free

The libdispatch Project, (a.k.a. Grand Central Dispatch), for concurrency on multicore hardware

FreeFree tier
Type
Open Source
Company
Apple

About apple/swift-corelibs-libdispatch

Grand Central Dispatch (GCD or libdispatch) is a library that provides comprehensive support for concurrent code execution on multicore hardware. It is natively available on all Darwin platforms, and this project aims to make a modern version of libdispatch available on all other Swift platforms, particularly Linux. The port to Linux has been completed and included in all Swift releases since Swift 3. The library uses user-space pthread primitives on Linux and is used by other swift-corelibs projects. Ongoing work includes developing a test suite for the Swift APIs and enhancing libdispatch to support Swift language evolution.

Key Features

Comprehensive support for concurrent code execution on multicore hardware
Portable subset of API available on Linux via user-space pthread primitives
Included in official Swift releases since Swift 3
Actively developed with latest release Swift 6.1.1 (May 2025)
Test suite available for Swift API validation
Supports Swift language evolution and other Core Libraries projects

Pros & Cons

Pros
  • Open source with Apache-2.0 license
  • Mature, battle-tested concurrency model from Apple
  • Ported to Linux and included in official Swift toolchains
  • Active maintenance with regular releases
  • Comprehensive documentation and build instructions
Cons
  • Linux port relies on user-space pthreads, not kernel-level scheduling like Darwin
  • Limited to Swift and C/Objective-C environments
  • Building from source may require manual configuration (see INSTALL.md)

Best For

Multicore concurrency in Swift applicationsCross-platform Swift development (macOS, iOS, Linux)Server-side Swift projects leveraging concurrent task executionBuilding high-performance, concurrent systems in Swift and C

FAQ

What is libdispatch?
libdispatch (Grand Central Dispatch) is a library that provides comprehensive support for concurrent code execution on multicore hardware.
What platforms is libdispatch available on?
It is natively available on all Darwin platforms. This project ports it to Linux and other non-Darwin Swift platforms.
Is libdispatch included in Swift releases?
Yes, on Linux it has been included in all Swift releases since Swift 3 and is used by other swift-corelibs projects.
How can I build and install libdispatch?
Detailed instructions are available in the INSTALL.md file in the repository.