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 { ... }
}
}
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 auserInfo
(or similar) data storage on EventLoop backed by aThreadSpecificVariable
. If at some point NIO decides to add such storage to the event loop, this could be removed.