Fully initialize ev.data.

On Linux systems, ev.data is an 8-byte field, but this code
currently initializes only 4 bytes of the field, leaving the
trailing 4 bytes unininitialized. This causes memory safety tools
like Valgrind to complain.

This patch no longer explicitly initializes .data, ensuring that C
structure initialization will force the .data field to be zero
initialized. Manual checks of the compiled binary show that the
compiler correctly initializes the 4 bytes for u32 only once, so
this change incurs minimal overhead.
1 file changed
tree: 42511343ff1630a87ac3df0ec6099d1fb1261b01
  1. .gitignore
  2. .gitmodules
  3. CMakeLists.txt
  5. INSTALL.md
  7. Makefile.am
  9. README.md
  10. TESTING.md
  11. autogen.sh
  12. cmake/
  13. config/
  14. configure.ac
  15. dispatch/
  16. libdispatch.xcodeproj/
  17. m4/
  18. man/
  19. os/
  20. private/
  21. resolver/
  22. src/
  23. tests/
  24. tools/
  25. xcodeconfig/
  26. xcodescripts/

Grand Central Dispatch

Grand Central Dispatch (GCD or libdispatch) provides comprehensive support for concurrent code execution on multicore hardware.

libdispatch is currently available on all Darwin platforms. This project aims to make a modern version of libdispatch available on all other Swift platforms. To do this, we will implement as much of the portable subset of the API as possible, using the existing open source C implementation.

libdispatch on Darwin is a combination of logic in the xnu kernel alongside the user-space Library. The kernel has the most information available to balance workload across the entire system. As a first step, however, we believe it is useful to bring up the basic functionality of the library using user-space pthread primitives on Linux. Eventually, a Linux kernel module could be developed to support more informed thread scheduling.

Project Status

A port of libdispatch to Linux has been completed. On Linux, since Swift 3, swift-corelibs-libdispatch has been included in all Swift releases and is used by other swift-corelibs projects.

Opportunities to contribute and on-going work include:

  1. Develop a test suite for the Swift APIs of libdispatch.
  2. Enhance libdispatch as needed to support Swift language evolution and the needs of the other Core Libraries projects.

Build and Install

For detailed instructions on building and installing libdispatch, see INSTALL.md


For detailed instructions on testing libdispatch, see TESTING.md