网站首页  词典首页

请输入您要查询的函数:

 

术语 tlsalloc
释义 TlsAlloc
语法:
C++
DWORD WINAPI TlsAlloc(void);
TlsAlloc函数
分配一个线程本地存储(TLS)的索引。该进程的任何线程可以随后使用该指数来存储和检索值是本地的线程,因为每个线程都收到该指数自己的插槽。
参数
这个函数没有参数。
返回值
如果函数成功,返回值是一个TLS索引。对于有指数的槽初始化为零。
如果函数失败,返回值是TLS_OUT_OF_INDEXES。为了获得更多错误信息,调用GetLastError。
备注
该进程的线程可以使用的TlsFree,TlsSetValue,或TlsGetValue职能随后调用TLS索引。该TLS索引值应被视为一个不透明的价值,不要以为这是对一个基于零的索引数组。
TLS的指标通常是在分配过程或动态链接库(DLL)初始化。 TLS索引后已分配过程的每一个线程可以使用它来访问自己的TLS的存储插槽。为了存储在TLS的槽值,指定一个线程在给TlsSetValue调用索引。该线程在其后指定调用相同指数TlsGetValue,检索储值。
TLS的指标不是有效的跨进程边界。一个DLL不能假设在一个进程分配一个指数是在另一个进程中有效。
实例
有关示例,请参阅使用线程本地存储或使用的动态线程本地存储链接库。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
进程和线程函数
线程本地存储
TlsFree
TlsGetValue
TlsSetValue
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==TlsAlloc Function
Allocates a thread local storage (TLS) index. Any thread of the process can subsequently use this index to store and retrieve values that are local to the thread, because each thread receives its own slot for the index.
Syntax
C++
DWORD WINAPI TlsAlloc(void);
Parameters
This function has no parameters.
Return Value
If the function succeeds, the return value is a TLS index. The slots for the index are initialized to zero.
If the function fails, the return value is TLS_OUT_OF_INDEXES. To get extended error information, call GetLastError .
Remarks
The threads of the process can use the TLS index in subsequent calls to the TlsFree , TlsSetValue , or TlsGetValue functions. The value of the TLS index should be treated as an opaque value; do not assume that it is an index into a zero-based array.
TLS indexes are typically allocated during process or dynamic-link library (DLL) initialization. After a TLS index has been allocated, each thread of the process can use it to access its own TLS storage slot. To store a value in its TLS slot, a thread specifies the index in a call to TlsSetValue. The thread specifies the same index in a subsequent call to TlsGetValue, to retrieve the stored value.
TLS indexes are not valid across process boundaries. A DLL cannot assume that an index assigned in one process is valid in another process.
Examples
For an example, see Using Thread Local Storage or Using Thread Local Storage in a Dynamic-Link Library .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
Process and Thread Functions
Thread Local Storage
TlsFree
TlsGetValue
TlsSetValue
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms686801(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:21:52