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

Side by Side Diff: nss/lib/pk11wrap/pk11list.c

Issue 2078763002: Delete bundled copy of NSS and replace with README. (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/nss@master
Patch Set: Delete bundled copy of NSS and replace with README. Created 4 years, 6 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
« no previous file with comments | « nss/lib/pk11wrap/pk11kea.c ('k') | nss/lib/pk11wrap/pk11load.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 /*
5 * Locking and queue management primatives
6 *
7 */
8
9 #include "seccomon.h"
10 #include "nssilock.h"
11 #include "secmod.h"
12 #include "secmodi.h"
13 #include "secmodti.h"
14 #include "nssrwlk.h"
15
16 /*
17 * create a new lock for a Module List
18 */
19 SECMODListLock *SECMOD_NewListLock()
20 {
21 return NSSRWLock_New( 10, "moduleListLock");
22 }
23
24 /*
25 * destroy the lock
26 */
27 void SECMOD_DestroyListLock(SECMODListLock *lock)
28 {
29 NSSRWLock_Destroy(lock);
30 }
31
32
33 /*
34 * Lock the List for Read: NOTE: this assumes the reading isn't so common
35 * the writing will be starved.
36 */
37 void SECMOD_GetReadLock(SECMODListLock *modLock)
38 {
39 NSSRWLock_LockRead(modLock);
40 }
41
42 /*
43 * Release the Read lock
44 */
45 void SECMOD_ReleaseReadLock(SECMODListLock *modLock)
46 {
47 NSSRWLock_UnlockRead(modLock);
48 }
49
50
51 /*
52 * lock the list for Write
53 */
54 void SECMOD_GetWriteLock(SECMODListLock *modLock)
55 {
56 NSSRWLock_LockWrite(modLock);
57 }
58
59
60 /*
61 * Release the Write Lock: NOTE, this code is pretty inefficient if you have
62 * lots of write collisions.
63 */
64 void SECMOD_ReleaseWriteLock(SECMODListLock *modLock)
65 {
66 NSSRWLock_UnlockWrite(modLock);
67 }
68
69
70 /*
71 * must Hold the Write lock
72 */
73 void
74 SECMOD_RemoveList(SECMODModuleList **parent, SECMODModuleList *child)
75 {
76 *parent = child->next;
77 child->next = NULL;
78 }
79
80 /*
81 * if lock is not specified, it must already be held
82 */
83 void
84 SECMOD_AddList(SECMODModuleList *parent, SECMODModuleList *child,
85 SECMODListLock *lock)
86 {
87 if (lock) { SECMOD_GetWriteLock(lock); }
88
89 child->next = parent->next;
90 parent->next = child;
91
92 if (lock) { SECMOD_ReleaseWriteLock(lock); }
93 }
94
95
OLDNEW
« no previous file with comments | « nss/lib/pk11wrap/pk11kea.c ('k') | nss/lib/pk11wrap/pk11load.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698