async-kit icon indicating copy to clipboard operation
async-kit copied to clipboard

thread-specific userInfo on event loop

Open tanner0101 opened this issue 6 years ago • 0 comments

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 { ... }
    }
}

tanner0101 avatar Nov 14 '18 07:11 tanner0101