Skip to content

Use of GCD in asynchronous context #185

@jbelkins

Description

@jbelkins

Describe the bug

GCD semaphores can cause unpredictable behavior when used from within a Swift asynchronous task.

The following was seen in the build logs when building aws-crt-swift:

/Users/runner/work/aws-sdk-swift/aws-sdk-swift/target/build/deps/aws-crt-swift/Source/Elasticurl/Elasticurl.swift:320:23: warning: instance method 'wait' is unavailable from asynchronous contexts; Await a Task handle instead; this is an error in Swift 6
            semaphore.wait()
                      ^
Dispatch.DispatchSemaphore:4:17: note: 'wait()' declared here
    public func wait()

Expected Behavior

aws-crt-swift does not use GCD semaphores within asynchronous code, and this warning is not generated

Current Behavior

The warning above (soon to be raised to an error) is generated at build time

Reproduction Steps

Build aws-crt-swift, observe build logs

Possible Solution

No response

Additional Information/Context

No response

AWS CRT SWIFT version used

0.9.0

Compiler and Version used

Xcode 14.3

Operating System and version

macOS 13.3.1

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.needs-reviewp2This is a standard priority issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions