Locks 编辑

This chapter describes the NSPR API for creation and manipulation of a mutex of type /wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PRLock.

In NSPR, a mutex of type /wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PRLock controls locking, and associated condition variables communicate changes in state among threads. When a programmer associates a mutex with an arbitrary collection of data, the mutex provides a protective monitor around the data.

In general, a monitor is a conceptual entity composed of a mutex, one or more condition variables, and the monitored data. Monitors in this generic sense should not be confused with monitors used in Java programming. In addition to /wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PRLock, NSPR provides another mutex type, /wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PRMonitor, which is reentrant and can have only one associated condition variable. /wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PRMonitor is intended for use with Java and reflects the Java approach to thread synchronization.

For an introduction to NSPR thread synchronization, including locks and condition variables, see Introduction to NSPR.

For reference information on NSPR condition variables, see Condition Variables.

Lock Type

Lock Functions

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:68 次

字数:3111

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文