mirror of
https://github.com/apple/swift-nio
synced 2026-11-30 05:28:44 +00:00
make SelectableEventLoop.description not take a lock (#1318)
Motivation: SelectableEventLoop's description was taking a lock and would also lock every single scheduled task. That's overkill. Modifications: Make it only log the thread and selector (which don't require locks). Result: better description
This commit is contained in:
1 parent
6174c9802c
commit
7bf170f63a
2 files changed
+7
-2
No files matched your search
@@ -474,9 +474,14 @@ internal final class SelectableEventLoop: EventLoop {
|
||||
}
|
||||
}
|
||||
|
||||
extension SelectableEventLoop: CustomStringConvertible {
|
||||
extension SelectableEventLoop: CustomStringConvertible, CustomDebugStringConvertible {
|
||||
@usableFromInline
|
||||
var description: String {
|
||||
return "SelectableEventLoop { selector = \(self._selector), thread = \(self.thread) }"
|
||||
}
|
||||
|
||||
@usableFromInline
|
||||
var debugDescription: String {
|
||||
return self._tasksLock.withLock {
|
||||
return "SelectableEventLoop { selector = \(self._selector), thread = \(self.thread), scheduledTasks = \(self._scheduledTasks.description) }"
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user