| OLD | NEW |
| 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ | 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 /* This Source Code Form is subject to the terms of the Mozilla Public | 2 /* This Source Code Form is subject to the terms of the Mozilla Public |
| 3 * License, v. 2.0. If a copy of the MPL was not distributed with this | 3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 5 | 5 |
| 6 /* | 6 /* |
| 7 ** File: ptio.c | 7 ** File: ptio.c |
| 8 ** Descritpion: Implemenation of I/O methods for pthreads | 8 ** Descritpion: Implemenation of I/O methods for pthreads |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 3747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3758 | 3758 |
| 3759 static PRInt32 _pr_poll_with_poll( | 3759 static PRInt32 _pr_poll_with_poll( |
| 3760 PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) | 3760 PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) |
| 3761 { | 3761 { |
| 3762 PRInt32 ready = 0; | 3762 PRInt32 ready = 0; |
| 3763 /* | 3763 /* |
| 3764 * For restarting poll() if it is interrupted by a signal. | 3764 * For restarting poll() if it is interrupted by a signal. |
| 3765 * We use these variables to figure out how much time has | 3765 * We use these variables to figure out how much time has |
| 3766 * elapsed and how much of the timeout still remains. | 3766 * elapsed and how much of the timeout still remains. |
| 3767 */ | 3767 */ |
| 3768 PRIntervalTime start, elapsed, remaining; | 3768 PRIntervalTime start = 0, elapsed, remaining; |
| 3769 | 3769 |
| 3770 if (pt_TestAbort()) return -1; | 3770 if (pt_TestAbort()) return -1; |
| 3771 | 3771 |
| 3772 if (0 == npds) PR_Sleep(timeout); | 3772 if (0 == npds) PR_Sleep(timeout); |
| 3773 else | 3773 else |
| 3774 { | 3774 { |
| 3775 #define STACK_POLL_DESC_COUNT 64 | 3775 #define STACK_POLL_DESC_COUNT 64 |
| 3776 struct pollfd stack_syspoll[STACK_POLL_DESC_COUNT]; | 3776 struct pollfd stack_syspoll[STACK_POLL_DESC_COUNT]; |
| 3777 struct pollfd *syspoll; | 3777 struct pollfd *syspoll; |
| 3778 PRIntn index, msecs; | 3778 PRIntn index, msecs; |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4012 */ | 4012 */ |
| 4013 static PRInt32 _pr_poll_with_select( | 4013 static PRInt32 _pr_poll_with_select( |
| 4014 PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) | 4014 PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) |
| 4015 { | 4015 { |
| 4016 PRInt32 ready = 0; | 4016 PRInt32 ready = 0; |
| 4017 /* | 4017 /* |
| 4018 * For restarting select() if it is interrupted by a signal. | 4018 * For restarting select() if it is interrupted by a signal. |
| 4019 * We use these variables to figure out how much time has | 4019 * We use these variables to figure out how much time has |
| 4020 * elapsed and how much of the timeout still remains. | 4020 * elapsed and how much of the timeout still remains. |
| 4021 */ | 4021 */ |
| 4022 PRIntervalTime start, elapsed, remaining; | 4022 PRIntervalTime start = 0, elapsed, remaining; |
| 4023 | 4023 |
| 4024 if (pt_TestAbort()) return -1; | 4024 if (pt_TestAbort()) return -1; |
| 4025 | 4025 |
| 4026 if (0 == npds) PR_Sleep(timeout); | 4026 if (0 == npds) PR_Sleep(timeout); |
| 4027 else | 4027 else |
| 4028 { | 4028 { |
| 4029 #define STACK_POLL_DESC_COUNT 64 | 4029 #define STACK_POLL_DESC_COUNT 64 |
| 4030 int stack_selectfd[STACK_POLL_DESC_COUNT]; | 4030 int stack_selectfd[STACK_POLL_DESC_COUNT]; |
| 4031 int *selectfd; | 4031 int *selectfd; |
| 4032 fd_set rd, wr, ex, *rdp = NULL, *wrp = NULL, *exp = NULL; | 4032 fd_set rd, wr, ex, *rdp = NULL, *wrp = NULL, *exp = NULL; |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4912 { | 4912 { |
| 4913 fd_set rd, wr, ex; | 4913 fd_set rd, wr, ex; |
| 4914 struct timeval tv, *tvp; | 4914 struct timeval tv, *tvp; |
| 4915 PRInt32 max, max_fd; | 4915 PRInt32 max, max_fd; |
| 4916 PRInt32 rv; | 4916 PRInt32 rv; |
| 4917 /* | 4917 /* |
| 4918 * For restarting select() if it is interrupted by a Unix signal. | 4918 * For restarting select() if it is interrupted by a Unix signal. |
| 4919 * We use these variables to figure out how much time has elapsed | 4919 * We use these variables to figure out how much time has elapsed |
| 4920 * and how much of the timeout still remains. | 4920 * and how much of the timeout still remains. |
| 4921 */ | 4921 */ |
| 4922 PRIntervalTime start, elapsed, remaining; | 4922 PRIntervalTime start = 0, elapsed, remaining; |
| 4923 | 4923 |
| 4924 static PRBool unwarned = PR_TRUE; | 4924 static PRBool unwarned = PR_TRUE; |
| 4925 if (unwarned) unwarned = _PR_Obsolete( "PR_Select", "PR_Poll"); | 4925 if (unwarned) unwarned = _PR_Obsolete( "PR_Select", "PR_Poll"); |
| 4926 | 4926 |
| 4927 FD_ZERO(&rd); | 4927 FD_ZERO(&rd); |
| 4928 FD_ZERO(&wr); | 4928 FD_ZERO(&wr); |
| 4929 FD_ZERO(&ex); | 4929 FD_ZERO(&ex); |
| 4930 | 4930 |
| 4931 max_fd = _PR_getset(pr_rd, &rd); | 4931 max_fd = _PR_getset(pr_rd, &rd); |
| 4932 max_fd = (max = _PR_getset(pr_wr, &wr))>max_fd?max:max_fd; | 4932 max_fd = (max = _PR_getset(pr_wr, &wr))>max_fd?max:max_fd; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5003 | 5003 |
| 5004 PR_IMPLEMENT(PRStatus) PR_GetFileInfo64UTF16(const PRUnichar *fn, PRFileInfo64 *
info) | 5004 PR_IMPLEMENT(PRStatus) PR_GetFileInfo64UTF16(const PRUnichar *fn, PRFileInfo64 *
info) |
| 5005 { | 5005 { |
| 5006 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); | 5006 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); |
| 5007 return PR_FAILURE; | 5007 return PR_FAILURE; |
| 5008 } | 5008 } |
| 5009 /* ================ UTF16 Interfaces ================================ */ | 5009 /* ================ UTF16 Interfaces ================================ */ |
| 5010 #endif /* MOZ_UNICODE */ | 5010 #endif /* MOZ_UNICODE */ |
| 5011 | 5011 |
| 5012 /* ptio.c */ | 5012 /* ptio.c */ |
| OLD | NEW |