vapor / async-kit

Sugary extensions for the SwiftNIO library
MIT License
71 stars 25 forks source link

thread-specific userInfo on event loop #8

Closed tanner0101 closed 1 year ago

tanner0101 commented 5 years ago

Currently there is no way to store arbitrary data on an event loop. It has been recommended previously to use a ThreadSpecificVariable instead. While this works, the purpose of the code is arguably less clear. I think it could be nice to implement a userInfo (or similar) data storage on EventLoop backed by a ThreadSpecificVariable. If at some point NIO decides to add such storage to the event loop, this could be removed.

extension EventLoop {
    var userInfo: [AnyHashable: Any] { 
        get { ... }
        set { ... }
    }
}