网站首页  词典首页

请输入您要查询的函数:

 

术语 createfiber
释义 CreateFiber
语法:
C++
LPVOID WINAPI CreateFiber(
__in SIZE_T dwStackSize,
__in LPFIBER_START_ROUTINE lpStartAddress,
__in_opt LPVOID lpParameter
);
CreateFiber功能
光纤分配对象,分配一个堆栈,并建立集,开始执行在指定的起始地址,通常是纤维的功能。此函数不时间表纤维。
既要指定承诺和储备堆栈的大小,使用CreateFiberEx功能。
参数
dwStackSize [in]
堆栈以字节为单位的初始大小。如果此参数为0,新的纤维使用默认的堆栈可执行文件的大小。有关更多信息,请参见线程堆栈大小。
lpStartAddress [in]
该申请的指针定义的函数被执行的纤维和代表了纤维的起始地址。新创建的纤维不会开始执行,直到另一个纤维调用该地址的SwitchToFiber功能。欲了解更多的纤维回调函数的详细信息,请参阅FiberProc。
lpParameter [中,可选]
一个变量传递到纤维的指针。该纤维可以检索使用GetFiberData宏观数据。
返回值
如果函数成功,返回值是光纤的地址。
如果函数失败,返回值为NULL。为了获得更多错误信息,调用GetLastError。
备注
该纤维可以创建一个进程的数目有限的可用虚拟内存。例如,如果您创建每个预留1兆光纤堆栈空间,您可以创建最多2028纤维。 If you reduce the default stack size by using the STACKSIZE statement in the module definition (.def) file or by using CreateFiberEx , you can create more fibers.但是,您的应用程序将有更好的表现,如果您使用,而不是建立这样一个大量的纤维处理请求替代战略。
前一个线程可以安排使用SwitchToFiber纤维的功能,它必须调用ConvertThreadToFiber职能,以便有与线程相关联的纤维。
要编译的应用程序使用此功能,定义_WIN32_WINNT为0x0400或更高版本。有关详细信息,请参阅使用Windows头。
实例
有关示例,请参阅使用纤维。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
ConvertThreadToFiber
CreateFiberEx
FiberProc
纤维
GetFiberData
进程和线程函数
SwitchToFiber
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==CreateFiber Function
Allocates a fiber object, assigns it a stack, and sets up execution to begin at the specified start address, typically the fiber function. This function does not schedule the fiber.
To specify both a commit and reserve stack size, use the CreateFiberEx function.
Syntax
C++
LPVOID WINAPI CreateFiber(
__in SIZE_T dwStackSize,
__in LPFIBER_START_ROUTINE lpStartAddress,
__in_opt LPVOID lpParameter
);
Parameters
dwStackSize [in]
The initial size of the stack, in bytes. If this parameter is zero, the new fiber uses the default stack size for the executable. For more information, see Thread Stack Size .
lpStartAddress [in]
A pointer to the application-defined function to be executed by the fiber and represents the starting address of the fiber. Execution of the newly created fiber does not begin until another fiber calls the SwitchToFiber function with this address. For more information of the fiber callback function, see FiberProc .
lpParameter [in, optional]
A pointer to a variable that is passed to the fiber. The fiber can retrieve this data by using the GetFiberData macro.
Return Value
If the function succeeds, the return value is the address of the fiber.
If the function fails, the return value is NULL. To get extended error information, call GetLastError .
Remarks
The number of fibers a process can create is limited by the available virtual memory. For example, if you create each fiber with 1 megabyte of reserved stack space, you can create at most 2028 fibers. If you reduce the default stack size by using the STACKSIZE statement in the module definition (.def) file or by using CreateFiberEx , you can create more fibers. However, your application will have better performance if you use an alternate strategy for processing requests instead of creating such a large number of fibers.
Before a thread can schedule a fiber using the SwitchToFiber function, it must call the ConvertThreadToFiber function so there is a fiber associated with the thread.
To compile an application that uses this function, define _WIN32_WINNT as 0x0400 or later. For more information, see Using the Windows Headers .
Examples
For an example, see Using Fibers .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
ConvertThreadToFiber
CreateFiberEx
FiberProc
Fibers
GetFiberData
Process and Thread Functions
SwitchToFiber
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms682402(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 13:26:07