Lines Matching defs:mon

47     PRMonitor *mon;
51 mon = PR_NEWZAP(PRMonitor);
52 if (mon) {
55 PR_DELETE(mon);
62 PR_DELETE(mon);
65 mon->cvar = cvar;
66 mon->name = NULL;
68 return mon;
73 PRMonitor* mon = PR_NewMonitor();
74 if (mon)
75 mon->name = name;
76 return mon;
84 PR_IMPLEMENT(void) PR_DestroyMonitor(PRMonitor *mon)
86 PR_DestroyLock(mon->cvar->lock);
87 PR_DestroyCondVar(mon->cvar);
88 PR_DELETE(mon);
94 PR_IMPLEMENT(void) PR_EnterMonitor(PRMonitor *mon)
96 if (mon->cvar->lock->owner == _PR_MD_CURRENT_THREAD()) {
97 mon->entryCount++;
99 PR_Lock(mon->cvar->lock);
100 mon->entryCount = 1;
109 PR_IMPLEMENT(PRBool) PR_TestAndEnterMonitor(PRMonitor *mon)
111 if (mon->cvar->lock->owner == _PR_MD_CURRENT_THREAD()) {
112 mon->entryCount++;
115 if (PR_TestAndLock(mon->cvar->lock)) {
116 mon->entryCount = 1;
126 PR_IMPLEMENT(PRStatus) PR_ExitMonitor(PRMonitor *mon)
128 if (mon->cvar->lock->owner != _PR_MD_CURRENT_THREAD()) {
131 if (--mon->entryCount == 0) {
132 return PR_Unlock(mon->cvar->lock);
141 PR_IMPLEMENT(PRIntn) PR_GetMonitorEntryCount(PRMonitor *mon)
143 return (mon->cvar->lock->owner == _PR_MD_CURRENT_THREAD()) ?
144 mon->entryCount : 0;
164 PR_IMPLEMENT(PRStatus) PR_Wait(PRMonitor *mon, PRIntervalTime ticks)
170 if (mon->cvar->lock->owner != me) return PR_FAILURE;
172 entryCount = mon->entryCount;
173 mon->entryCount = 0;
175 status = _PR_WaitCondVar(me, mon->cvar, mon->cvar->lock, ticks);
177 mon->entryCount = entryCount;
187 PR_IMPLEMENT(PRStatus) PR_Notify(PRMonitor *mon)
190 if (mon->cvar->lock->owner != me) return PR_FAILURE;
191 PR_NotifyCondVar(mon->cvar);
200 PR_IMPLEMENT(PRStatus) PR_NotifyAll(PRMonitor *mon)
203 if (mon->cvar->lock->owner != me) return PR_FAILURE;
204 PR_NotifyAllCondVar(mon->cvar);
210 PRUint32 _PR_MonitorToString(PRMonitor *mon, char *buf, PRUint32 buflen)
214 if (mon->cvar->lock->owner) {
216 mon, mon->cvar->lock->owner->id,
217 mon->cvar->lock->owner, mon->entryCount);
219 nb = PR_snprintf(buf, buflen, "[%p]", mon);