Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: runtime/bin/fdutils_macos.cc

Issue 9225019: Fix race condition between signal handler and main thread. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/file_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include <errno.h> 5 #include <errno.h>
6 #include <fcntl.h> 6 #include <fcntl.h>
7 #include <unistd.h> 7 #include <unistd.h>
8 #include <sys/ioctl.h> 8 #include <sys/ioctl.h>
9 9
10 #include "bin/fdutils.h" 10 #include "bin/fdutils.h"
(...skipping 24 matching lines...) Expand all
35 } 35 }
36 *is_blocking = (status & O_NONBLOCK) == 0; 36 *is_blocking = (status & O_NONBLOCK) == 0;
37 return true; 37 return true;
38 } 38 }
39 39
40 40
41 intptr_t FDUtils::AvailableBytes(intptr_t fd) { 41 intptr_t FDUtils::AvailableBytes(intptr_t fd) {
42 int available; // ioctl for FIONREAD expects an 'int*' argument. 42 int available; // ioctl for FIONREAD expects an 'int*' argument.
43 int result = TEMP_FAILURE_RETRY(ioctl(fd, FIONREAD, &available)); 43 int result = TEMP_FAILURE_RETRY(ioctl(fd, FIONREAD, &available));
44 if (result < 0) { 44 if (result < 0) {
45 perror("ioctl FIONREAD failed");
45 return result; 46 return result;
46 } 47 }
47 #ifdef DEBUG 48 #ifdef DEBUG
48 ASSERT(available >= 0); 49 ASSERT(available >= 0);
49 #endif 50 #endif
50 return static_cast<intptr_t>(available); 51 return static_cast<intptr_t>(available);
51 } 52 }
52 53
53 54
54 ssize_t FDUtils::ReadFromBlocking(int fd, void* buffer, size_t count) { 55 ssize_t FDUtils::ReadFromBlocking(int fd, void* buffer, size_t count) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 ASSERT(errno != EWOULDBLOCK); 100 ASSERT(errno != EWOULDBLOCK);
100 return -1; 101 return -1;
101 } else { 102 } else {
102 ASSERT(bytes_written > 0); 103 ASSERT(bytes_written > 0);
103 remaining -= bytes_written; 104 remaining -= bytes_written;
104 buffer_pos += bytes_written; 105 buffer_pos += bytes_written;
105 } 106 }
106 } 107 }
107 return count; 108 return count;
108 } 109 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/file_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698