WPUOpenCurrentThread

The WPUOpenCurrentThread function opens a handle to the current thread that can be used with overlapped functions in a layered service provider. This is intended to be used by layered service providers that wish to initiate overlapped IO from non-application threads.

INT WPUOpenCurrentThread (
  LPWSATHREADID lpThreadId,   
  LPINT lpErrno               
);
 

Parameters

lpThreadId
[out] A pointer to a WSATHREADID structure that can then be passed to an overlapped function.
lpErrno
[out] A pointer to the error code.

Remarks

The WPUOpenCurrentThread function provides a pointer to a WSATHREADID structure that can then be passed to an overlapped function such as WSPSend or WSPRecv. Layered service providers that use a private thread in one of the upper layers will use WPUOpenCurrentThread to pass a WSATHREADID pointer to the lower layer that is administering overlapped functions.

Overlapped functions such as WSPSend and WSPRecv can then be used in the same way as a regular service provider.

Every call to WPUOpenCurrentThread must have a corresponding call to WPUCloseThread.

Return Values

If no error occurs, WPUOpenCurrentThread returns the zero. Otherwise, it returns SOCKET_ERROR, and a specific error code is available in lpErrno.

Error Codes

WSANOTINITIALISED A successful WSPStartup must occur before using this function.

QuickInfo

  Windows NT: Yes
  Windows: Yes
  Windows CE: Unsupported.
  Header: Declared in ws2spi.h.

See Also

WPUCloseThread, WSPSend, WSPRecv, WPUOpenCurrentThread