nspr线程相关
来源:互联网 发布:舆情调查软件 编辑:程序博客网 时间:2024/06/08 02:14
NSPR 线程
PRThread *thr;
thr = PR_CreateThread(PR_USER_THREAD,
hello_thread,
NULL,
PR_PRIORITY_NORMAL,
PR_LOCAL_THREAD,
PR_JOINABLE_THREAD,
0);
#include <prthread.h>
typedef enum PRThreadType {
PR_USER_THREAD,
PR_SYSTEM_THREAD
} PRThreadType;
Enumerators
PR_USER_THREAD
PR_Cleanup blocks until the last thread of type PR_USER_THREAD terminates.
PR_Cleanup 会阻塞等待最后一个PR_USER_THREAD线程才往下执行
PR_SYSTEM_THREAD
NSPR ignores threads of type PR_SYSTEM_THREAD when determining when a call to PR_Cleanup should return.
===========================================================================================================
#include <prthread.h>
typedef enum PRThreadScope {
PR_LOCAL_THREAD,
PR_GLOBAL_THREAD
PR_GLOBAL_BOUND_THREAD
} PRThreadScope;
PR_LOCAL_THREAD 默认用这个
===========================================================================================================
typedef enum PRThreadState {
PR_JOINABLE_THREAD,
PR_UNJOINABLE_THREAD
} PRThreadState;
PR_UNJOINABLE_THREAD 类型分离式,主线程退出,不等待子线程,子线程自己退出释放资源
PR_JOINABLE_THREAD 类型,主线程需要调用PR_JoinThread(thr); 等待线程退出,才会释放资源
===========================================================================================================
优先级默认用:PR_PRIORITY_NORMAL
#include <prthread.h>
typedef enum PRThreadPriority
{
PR_PRIORITY_FIRST = 0,
PR_PRIORITY_LOW = 0,
PR_PRIORITY_NORMAL = 1,
PR_PRIORITY_HIGH = 2,
PR_PRIORITY_URGENT = 3,
PR_PRIORITY_LAST = 3
} PRThreadPriority;
Enumerators
PR_PRIORITY_FIRST
Placeholder.
PR_PRIORITY_LOW
The lowest possible priority. This priority is appropriate for threads that are expected to perform intensive computation.
PR_PRIORITY_NORMAL
The most commonly expected priority.
PR_PRIORITY_HIGH
Slightly higher priority than PR_PRIORITY_NORMAL. This priority is for threads performing work of high urgency but short duration.
PR_PRIORITY_URGENT
Highest priority. Only one thread at a time typically has this priority.
PR_PRIORITY_LAST
Placeholder
PRThread *thr;
thr = PR_CreateThread(PR_USER_THREAD,
hello_thread,
NULL,
PR_PRIORITY_NORMAL,
PR_LOCAL_THREAD,
PR_JOINABLE_THREAD,
0);
#include <prthread.h>
typedef enum PRThreadType {
PR_USER_THREAD,
PR_SYSTEM_THREAD
} PRThreadType;
Enumerators
PR_USER_THREAD
PR_Cleanup blocks until the last thread of type PR_USER_THREAD terminates.
PR_Cleanup 会阻塞等待最后一个PR_USER_THREAD线程才往下执行
PR_SYSTEM_THREAD
NSPR ignores threads of type PR_SYSTEM_THREAD when determining when a call to PR_Cleanup should return.
===========================================================================================================
#include <prthread.h>
typedef enum PRThreadScope {
PR_LOCAL_THREAD,
PR_GLOBAL_THREAD
PR_GLOBAL_BOUND_THREAD
} PRThreadScope;
PR_LOCAL_THREAD 默认用这个
===========================================================================================================
typedef enum PRThreadState {
PR_JOINABLE_THREAD,
PR_UNJOINABLE_THREAD
} PRThreadState;
PR_UNJOINABLE_THREAD 类型分离式,主线程退出,不等待子线程,子线程自己退出释放资源
PR_JOINABLE_THREAD 类型,主线程需要调用PR_JoinThread(thr); 等待线程退出,才会释放资源
===========================================================================================================
优先级默认用:PR_PRIORITY_NORMAL
#include <prthread.h>
typedef enum PRThreadPriority
{
PR_PRIORITY_FIRST = 0,
PR_PRIORITY_LOW = 0,
PR_PRIORITY_NORMAL = 1,
PR_PRIORITY_HIGH = 2,
PR_PRIORITY_URGENT = 3,
PR_PRIORITY_LAST = 3
} PRThreadPriority;
Enumerators
PR_PRIORITY_FIRST
Placeholder.
PR_PRIORITY_LOW
The lowest possible priority. This priority is appropriate for threads that are expected to perform intensive computation.
PR_PRIORITY_NORMAL
The most commonly expected priority.
PR_PRIORITY_HIGH
Slightly higher priority than PR_PRIORITY_NORMAL. This priority is for threads performing work of high urgency but short duration.
PR_PRIORITY_URGENT
Highest priority. Only one thread at a time typically has this priority.
PR_PRIORITY_LAST
Placeholder
阅读全文
0 0
- nspr线程相关
- mozilla code -nspr 线程同步
- 线程相关
- 线程相关
- 线程相关
- 线程相关
- 线程相关
- 线程相关。
- 线程相关
- 线程相关
- 线程相关
- 线程相关
- 线程相关
- 线程相关
- 线程相关
- 线程相关
- mozilla code nspr 多线程基础
- nspr.h: No such file or directory
- Pandas学习总结(上)
- 常见类---BigDecimal类
- 设计模式之单例模式
- (noip 模拟 染色)<树形DP>
- Prime Factors
- nspr线程相关
- opencv读取txt文件,并赋值为Mat矩阵
- ELF文件加密相关
- Java设计模式--原型模式【Prototype Pattern】
- storm worker数量设置
- Windows下zookeeper的伪集群搭建
- maven学习笔记(六)在eclipse上使用maven
- 中国剩余原理
- oracle设置字母大小写不敏感对impdp无效