| OLD | NEW |
| 1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 */ | 4 |
| 5 #include "nacl_io/kernel_object.h" | 5 #include "nacl_io/kernel_object.h" |
| 6 | 6 |
| 7 #include <assert.h> | 7 #include <assert.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <pthread.h> | 10 #include <pthread.h> |
| 11 | 11 |
| 12 #include <algorithm> | 12 #include <algorithm> |
| 13 #include <map> | 13 #include <map> |
| 14 #include <string> | 14 #include <string> |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 190 |
| 191 void KernelObject::FreeFD(int fd) { | 191 void KernelObject::FreeFD(int fd) { |
| 192 AUTO_LOCK(handle_lock_); | 192 AUTO_LOCK(handle_lock_); |
| 193 | 193 |
| 194 handle_map_[fd].reset(NULL); | 194 handle_map_[fd].reset(NULL); |
| 195 free_fds_.push_back(fd); | 195 free_fds_.push_back(fd); |
| 196 | 196 |
| 197 // Force lower numbered FD to be available first. | 197 // Force lower numbered FD to be available first. |
| 198 std::push_heap(free_fds_.begin(), free_fds_.end(), std::greater<int>()); | 198 std::push_heap(free_fds_.begin(), free_fds_.end(), std::greater<int>()); |
| 199 } | 199 } |
| OLD | NEW |