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: ptsynch.c | 7 ** File: ptsynch.c |
8 ** Descritpion: Implemenation for thread synchronization using pthreads | 8 ** Descritpion: Implemenation for thread synchronization using pthreads |
9 ** Exports: prlock.h, prcvar.h, prmon.h, prcmon.h | 9 ** Exports: prlock.h, prcvar.h, prmon.h, prcmon.h |
10 */ | 10 */ |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 mon->refCount = 1; | 507 mon->refCount = 1; |
508 mon->name = NULL; | 508 mon->name = NULL; |
509 return mon; | 509 return mon; |
510 | 510 |
511 error3: | 511 error3: |
512 pthread_cond_destroy(&mon->entryCV); | 512 pthread_cond_destroy(&mon->entryCV); |
513 error2: | 513 error2: |
514 pthread_mutex_destroy(&mon->lock); | 514 pthread_mutex_destroy(&mon->lock); |
515 error1: | 515 error1: |
516 PR_Free(mon); | 516 PR_Free(mon); |
517 PR_SetError(PR_OPERATION_NOT_SUPPORTED_ERROR, 0); | 517 _PR_MD_MAP_DEFAULT_ERROR(rv); |
518 return NULL; | 518 return NULL; |
519 } /* PR_NewMonitor */ | 519 } /* PR_NewMonitor */ |
520 | 520 |
521 PR_IMPLEMENT(PRMonitor*) PR_NewNamedMonitor(const char* name) | 521 PR_IMPLEMENT(PRMonitor*) PR_NewNamedMonitor(const char* name) |
522 { | 522 { |
523 PRMonitor* mon = PR_NewMonitor(); | 523 PRMonitor* mon = PR_NewMonitor(); |
524 if (mon) | 524 if (mon) |
525 mon->name = name; | 525 mon->name = name; |
526 return mon; | 526 return mon; |
527 } | 527 } |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 int rv; | 1231 int rv; |
1232 PR_ASSERT(cvar != NULL); | 1232 PR_ASSERT(cvar != NULL); |
1233 rv = pthread_cond_broadcast(&cvar->cv); | 1233 rv = pthread_cond_broadcast(&cvar->cv); |
1234 PR_ASSERT(0 == rv); | 1234 PR_ASSERT(0 == rv); |
1235 return PR_SUCCESS; | 1235 return PR_SUCCESS; |
1236 } /* PRP_NakedBroadcast */ | 1236 } /* PRP_NakedBroadcast */ |
1237 | 1237 |
1238 #endif /* defined(_PR_PTHREADS) */ | 1238 #endif /* defined(_PR_PTHREADS) */ |
1239 | 1239 |
1240 /* ptsynch.c */ | 1240 /* ptsynch.c */ |
OLD | NEW |