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
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/. */
10 ** Interface to cached monitors. Cached monitors use an address to find a
11 ** given PR monitor. In this way a monitor can be associated with another
12 ** object without preallocating a monitor for all objects.
14 ** A hash table is used to quickly map addresses to individual monitors
15 ** and the system automatically grows the hash table as needed.
17 ** Cache monitors are about 5 times slower to use than uncached monitors.
25 ** Like PR_EnterMonitor except use the "address" to find a monitor in the
26 ** monitor cache. If successful, returns the PRMonitor now associated
27 ** with "address". Note that you must PR_CExitMonitor the address to
28 ** release the monitor cache entry (otherwise the monitor cache will fill
29 ** up). This call will return NULL if the monitor cache needs to be
30 ** expanded and the system is out of memory.
32 NSPR_API(PRMonitor
*) PR_CEnterMonitor(void *address
);
35 ** Like PR_ExitMonitor except use the "address" to find a monitor in the
38 NSPR_API(PRStatus
) PR_CExitMonitor(void *address
);
41 ** Like PR_Wait except use the "address" to find a monitor in the
44 NSPR_API(PRStatus
) PR_CWait(void *address
, PRIntervalTime timeout
);
47 ** Like PR_Notify except use the "address" to find a monitor in the
50 NSPR_API(PRStatus
) PR_CNotify(void *address
);
53 ** Like PR_NotifyAll except use the "address" to find a monitor in the
56 NSPR_API(PRStatus
) PR_CNotifyAll(void *address
);
59 ** Set a callback to be invoked each time a monitor is recycled from the cache
60 ** freelist, with the monitor's cache-key passed in address.
62 NSPR_API(void) PR_CSetOnMonitorRecycle(void (PR_CALLBACK
*callback
)(void *address
));
66 #endif /* prcmon_h___ */