funcmike / rabbitmq-nio

A Swift implementation of AMQP 0.9.1 protocol: decoder + encoder and non-blocking client
Apache License 2.0
44 stars 8 forks source link

Mark types as `Sendable` #6

Closed fabianfett closed 1 year ago

fabianfett commented 1 year ago

I highly recommend marking the types that can be accessed from different threads as Sendable. You only support Swift 5.7+ where Sendable works quite well.

This way you would have noticed that this lock is not needed:

https://github.com/funcmike/rabbitmq-nio/blob/80f7af653548c96321d8926de0a90452b6979411/Sources/AMQPClient/AMQPChannels.swift#L18

structs that contain only sendable types are sendable as well. The sensibility is enforced through the copy semantics that structs have.