网站首页  词典首页

请输入您要查询的函数:

 

术语 avrtcreatethreadorderinggroup
释义 AvRtCreateThreadOrderingGroup
语法:
C++
BOOL WINAPI AvRtCreateThreadOrderingGroup(
__out PHANDLE Context,
__in PLARGE_INTEGER Period,
__inout GUID *ThreadOrderingGuid,
__in_opt PLARGE_INTEGER Timeout
);
AvRtCreateThreadOrderingGroup功能
创建一个线程顺序组。
为了防止从订货组服务器线程线程被饿死,如果更高的优先级客户端线程在运行,使用AvRtCreateThreadOrderingGroupEx功能。
参数
上下文[out]
一个上下文句柄的指针。
期 [in]
阿指针的值在100纳秒的增量,即指定了订货组线程时期。订货中的每个线程的线程组在此期间运行一次。如果所有的线程完成之前,其执行期结束,直到所有的线程的剩余时间之前经过任何等待被执行了。
此参数的依赖于平台的可能值,但此参数可高达500微秒或在0x1FFFFFFFFFFFFFFF高低。如果这个参数小于500微秒,那么它被设置为500微秒。如果该参数大于最大,那么它设置为0x1FFFFFFFFFFFFFFF。
ThreadOrderingGuid [ in , out ]
A中的线程组的排序独特的识别要创建的指针。如果此值不是唯一的线程订购服务,功能失败。
如果标识符输入GUID_NULL上,该线程订购服务生成并返回一个唯一的标识符。
超时[中,可选]
如果一时间指针的超时值。集团内的所有线程完成其应加上超时周期内执行。
如果一个线程未能完成的期限内,加上这个超时时间间隔的处理,这是删除从订货组线程。如果父母未能完成的期限内,加上超时间隔,其处理,排序的线程组被摧毁。
此参数的依赖于平台的可能值,但可以低至500微秒或在0x1FFFFFFFFFFFFFFF高。如果这个参数小于500微秒,那么它被设置为500微秒。如果该参数大于最大,那么它设置为0x1FFFFFFFFFFFFFFF。
如果此参数为NULL或0,默认是5倍时期的价值。
如果这个参数是THREAD_ORDER_GROUP_INFINITE_TIMEOUT,该集团是创建一个无限超时间隔。这可用于用于调试目的。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
如果一个线程命令将指定标识符组已经存在的函数失败并设置最后一个错误的ERROR_ALREADY_EXISTS。
备注
调用线程被认为是父线程。每个线程订货组都有一个父线程。每个父线程可以零个或多个线程和前任零个或多个继承线程。客户端线程可以加入线程订货小组,并指定它是否是前置任务或后续使用AvRtJoinThreadOrderingGroup功能。
父线程包围将在每个内,这是由AvRtWaitOnThreadOrderingGroup函数控制的循环期间执行的代码。
要删除线程订货组,调用AvRtDeleteThreadOrderingGroup功能。
一个线程可以创建多个线程订货组和加入多个线程顺序组。 However, a thread cannot join the same thread ordering group more than one time.
实例
下面的代码创建一个线程顺序组。

#include
#include
#include
#pragma comment(lib, "Avrt.lib")
#define _100NS_IN_1MS 10000
void main()
{
 HANDLE hContext = NULL;
 LARGE_INTEGER period, timeout;
 GUID guid = { 0 };
 BOOL bRes;
 period.QuadPart = Int32x32To64(_100NS_IN_1MS, 1000); // 1 second
 timeout.QuadPart = Int32x32To64(_100NS_IN_1MS, 10000); // 10 seconds
 bRes = AvRtCreateThreadOrderingGroup(
 &hContext,
 &period,
 &guid,
 &timeout );
 if( bRes != TRUE )
 {
  printf("Error creating group (%d)\\n", GetLastError());
 }
}
要求:
client最低支持Vista
server最低支持 Windows Server 2008
HeaderAvrt.h
LibraryAvrt.lib
DLLAvrt.dll
参见
螺纹订购服务
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==AvRtCreateThreadOrderingGroup Function
Creates a thread ordering group.
To prevent the server thread for the thread ordering group from being starved if higher priority client threads are running, use the AvRtCreateThreadOrderingGroupEx function.
Syntax
C++
BOOL WINAPI AvRtCreateThreadOrderingGroup(
__out PHANDLE Context,
__in PLARGE_INTEGER Period,
__inout GUID *ThreadOrderingGuid,
__in_opt PLARGE_INTEGER Timeout
);
Parameters
Context [out]
A pointer to a context handle.
Period [in]
A pointer to a value, in 100-nanosecond increments, that specifies the period for the thread ordering group. Each thread in the thread ordering group runs one time during this period. If all threads complete their execution before a period ends, all threads wait until the remainder of the period elapses before any are executed again.
The possible values for this parameter depend on the platform, but this parameter can be as low as 500 microseconds or as high as 0x1FFFFFFFFFFFFFFF. If this parameter is less than 500 microseconds, then it is set to 500 microseconds. If this parameter is greater than the maximum, then it is set to 0x1FFFFFFFFFFFFFFF.
ThreadOrderingGuid [in, out]
A pointer to the unique identifier for the thread ordering group to be created. If this value is not unique to the thread ordering service, the function fails.
If the identifier is GUID_NULL on input, the thread ordering service generates and returns a unique identifier.
Timeout [in, optional]
A pointer to a time-out value. All threads within the group should complete their execution within Period plus Timeout.
If a thread fails to complete its processing within the period plus this time-out interval, it is removed from the thread ordering group. If the parent fails to complete its processing within the period plus the time-out interval, the thread ordering group is destroyed.
The possible values for this parameter depend on the platform, but can be as low as 500 microseconds or as high as 0x1FFFFFFFFFFFFFFF. If this parameter is less than 500 microseconds, then it is set to 500 microseconds. If this parameter is greater than the maximum, then it is set to 0x1FFFFFFFFFFFFFFF.
If this parameter is NULL or 0, the default is five times the value of Period.
If this parameter is THREAD_ORDER_GROUP_INFINITE_TIMEOUT, the group is created with an infinite time-out interval. This can be useful for debugging purposes.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError .
If a thread ordering group with the specified identifier already exists, the function fails and sets the last error to ERROR_ALREADY_EXISTS.
Remarks
The calling thread is considered to be the parent thread. Each thread ordering group has one parent thread. Each parent thread can have zero or more predecessor threads and zero or more successor threads. A client thread can join a thread ordering group and specify whether it is a predecessor or successor using the AvRtJoinThreadOrderingGroup function.
The parent thread encloses the code to be executed during each period within a loop that is controlled by the AvRtWaitOnThreadOrderingGroup function.
To delete the thread ordering group, call the AvRtDeleteThreadOrderingGroup function.
A thread can create more than one thread ordering group and join more than one thread ordering group. However, a thread cannot join the same thread ordering group more than one time.
Examples
The following snippet creates a thread ordering group.
#include
#include
#include
#pragma comment(lib, "Avrt.lib")
#define _100NS_IN_1MS 10000
void main()
{
 HANDLE hContext = NULL;
 LARGE_INTEGER period, timeout;
 GUID guid = { 0 };
 BOOL bRes;
 period.QuadPart = Int32x32To64(_100NS_IN_1MS, 1000); // 1 second
 timeout.QuadPart = Int32x32To64(_100NS_IN_1MS, 10000); // 10 seconds
 bRes = AvRtCreateThreadOrderingGroup(
 &hContext,
 &period,
 &guid,
 &timeout );
 if( bRes != TRUE )
 {
  printf("Error creating group (%d)\\n", GetLastError());
 }
}
Requirements
Minimum supported clientWindows Vista
Minimum supported serverWindows Server 2008
HeaderAvrt.h
LibraryAvrt.lib
DLLAvrt.dll
See Also
Thread Ordering Service
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms681962(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:31:42