| OLD | NEW |
| 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| 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: ptthread.c | 7 ** File: ptthread.c |
| 8 ** Descritpion: Implemenation for threds using pthreds | 8 ** Descritpion: Implemenation for threds using pthreds |
| 9 ** Exports: ptthread.h | 9 ** Exports: ptthread.h |
| 10 */ | 10 */ |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 } /* PR_GetThreadState */ | 673 } /* PR_GetThreadState */ |
| 674 | 674 |
| 675 PR_IMPLEMENT(PRThreadPriority) PR_GetThreadPriority(const PRThread *thred) | 675 PR_IMPLEMENT(PRThreadPriority) PR_GetThreadPriority(const PRThread *thred) |
| 676 { | 676 { |
| 677 PR_ASSERT(thred != NULL); | 677 PR_ASSERT(thred != NULL); |
| 678 return thred->priority; | 678 return thred->priority; |
| 679 } /* PR_GetThreadPriority */ | 679 } /* PR_GetThreadPriority */ |
| 680 | 680 |
| 681 PR_IMPLEMENT(void) PR_SetThreadPriority(PRThread *thred, PRThreadPriority newPri
) | 681 PR_IMPLEMENT(void) PR_SetThreadPriority(PRThread *thred, PRThreadPriority newPri
) |
| 682 { | 682 { |
| 683 PRIntn rv = -1; | 683 PRIntn rv; |
| 684 | 684 |
| 685 PR_ASSERT(NULL != thred); | 685 PR_ASSERT(NULL != thred); |
| 686 | 686 |
| 687 if ((PRIntn)PR_PRIORITY_FIRST > (PRIntn)newPri) | 687 if ((PRIntn)PR_PRIORITY_FIRST > (PRIntn)newPri) |
| 688 newPri = PR_PRIORITY_FIRST; | 688 newPri = PR_PRIORITY_FIRST; |
| 689 else if ((PRIntn)PR_PRIORITY_LAST < (PRIntn)newPri) | 689 else if ((PRIntn)PR_PRIORITY_LAST < (PRIntn)newPri) |
| 690 newPri = PR_PRIORITY_LAST; | 690 newPri = PR_PRIORITY_LAST; |
| 691 | 691 |
| 692 #if defined(_PR_DCETHREADS) | 692 #if defined(_PR_DCETHREADS) |
| 693 rv = pthread_setprio(thred->id, pt_PriorityMap(newPri)); | 693 rv = pthread_setprio(thred->id, pt_PriorityMap(newPri)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 if (rv == -1) | 729 if (rv == -1) |
| 730 { | 730 { |
| 731 /* We don't set pt_schedpriv to EPERM in case errno == EPERM | 731 /* We don't set pt_schedpriv to EPERM in case errno == EPERM |
| 732 * because adjusting the nice value might be permitted for certain | 732 * because adjusting the nice value might be permitted for certain |
| 733 * ranges but not for others. */ | 733 * ranges but not for others. */ |
| 734 PR_LOG(_pr_thread_lm, PR_LOG_MIN, | 734 PR_LOG(_pr_thread_lm, PR_LOG_MIN, |
| 735 ("PR_SetThreadPriority: setpriority failed with error %d", | 735 ("PR_SetThreadPriority: setpriority failed with error %d", |
| 736 errno)); | 736 errno)); |
| 737 } | 737 } |
| 738 } | 738 } |
| 739 #else |
| 740 (void)rv; /* rv is unused */ |
| 739 #endif | 741 #endif |
| 740 | 742 |
| 741 thred->priority = newPri; | 743 thred->priority = newPri; |
| 742 } /* PR_SetThreadPriority */ | 744 } /* PR_SetThreadPriority */ |
| 743 | 745 |
| 744 PR_IMPLEMENT(PRStatus) PR_Interrupt(PRThread *thred) | 746 PR_IMPLEMENT(PRStatus) PR_Interrupt(PRThread *thred) |
| 745 { | 747 { |
| 746 /* | 748 /* |
| 747 ** If the target thread indicates that it's waiting, | 749 ** If the target thread indicates that it's waiting, |
| 748 ** find the condition and broadcast to it. Broadcast | 750 ** find the condition and broadcast to it. Broadcast |
| (...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1805 PR_IMPLEMENT(const char *) PR_GetThreadName(const PRThread *thread) | 1807 PR_IMPLEMENT(const char *) PR_GetThreadName(const PRThread *thread) |
| 1806 { | 1808 { |
| 1807 if (!thread) | 1809 if (!thread) |
| 1808 return NULL; | 1810 return NULL; |
| 1809 return thread->name; | 1811 return thread->name; |
| 1810 } | 1812 } |
| 1811 | 1813 |
| 1812 #endif /* defined(_PR_PTHREADS) || defined(_PR_DCETHREADS) */ | 1814 #endif /* defined(_PR_PTHREADS) || defined(_PR_DCETHREADS) */ |
| 1813 | 1815 |
| 1814 /* ptthread.c */ | 1816 /* ptthread.c */ |
| OLD | NEW |