Chromium Code Reviews| Index: dart/runtime/bin/eventhandler_macos.cc |
| diff --git a/dart/runtime/bin/eventhandler_macos.cc b/dart/runtime/bin/eventhandler_macos.cc |
| index 6caadc09622776e84c070dfddb4a2a5f7ef2e33d..97f3e628cdf006b7009e0940f4a7434944d861b4 100644 |
| --- a/dart/runtime/bin/eventhandler_macos.cc |
| +++ b/dart/runtime/bin/eventhandler_macos.cc |
| @@ -241,18 +241,17 @@ void EventHandlerImplementation::HandleInterruptFd() { |
| // We only close the socket file descriptor from the operating |
| // system if there are no other dart socket objects which |
| // are listening on the same (address, port) combination. |
| - |
| - // TODO(dart:io): This assumes that all sockets listen before we |
| - // close. |
| - // This needs to be synchronized with a global datastructure. |
| - if (new_mask == 0) { |
| - socket_map_.Remove( |
| - GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd)); |
| + ListeningSocketRegistry *registry = |
| + ListeningSocketRegistry::Instance(); |
| + |
| + MutexLocker locker(registry->mutex()); |
|
Søren Gjesse
2015/02/11 08:51:05
nit: Formatting (number of empty lines) of this se
kustermann
2015/02/11 09:56:08
Done.
|
| + if (registry->CloseSafe(fd)) { |
| + ASSERT(new_mask == 0); |
| + socket_map_.Remove(GetHashmapKeyFromFd(fd), |
| + GetHashmapHashFromFd(fd)); |
| di->Close(); |
| delete di; |
| } |
| - |
| - |
| } else { |
| ASSERT(new_mask == 0); |
| socket_map_.Remove( |