PRThreadScope 编辑

The scope of an NSPR thread, specified as a parameter to /wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PR_CreateThread or returned by /wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PR_GetThreadScope.

Syntax

#include <prthread.h>

typedef enum PRThreadScope {
   PR_LOCAL_THREAD,
   PR_GLOBAL_THREAD
   PR_GLOBAL_BOUND_THREAD
} PRThreadScope;

Enumerators

PR_LOCAL_THREAD
A local thread, scheduled locally by NSPR within the process.
PR_GLOBAL_THREAD
A global thread, scheduled by the host OS.
PR_GLOBAL_BOUND_THREAD
A global bound (kernel) thread, scheduled by the host OS

Description

An enumerator of type PRThreadScope specifies how a thread is scheduled: either locally by NSPR within the process (a local thread) or globally by the host (a global thread).

Global threads are scheduled by the host OS and compete with all other threads on the host OS for resources. They are subject to fairly sophisticated scheduling techniques.

Local threads are scheduled by NSPR within the process. The process is assumed to be globally scheduled, but NSPR can manipulate local threads without system intervention. In most cases, this leads to a significant performance benefit.

However, on systems that require NSPR to make a distinction between global and local threads, global threads are invariably required to do any form of I/O. If a thread is likely to do a lot of I/O, making it a global thread early is probably warranted.

On systems that don't make a distinction between local and global threads, NSPR silently ignores the scheduling request. To find the scope of the thread, call /wiki/en-US/docs/Mozilla/Projects/NSPR/Reference/PR_GetThreadScope.

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

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

发布评论

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

词条统计

浏览:100 次

字数:2386

最后编辑:7年前

编辑次数:0 次

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