Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the definition of _TP_POOL structure?

In order to translate windows vista thread pool API to use in my delphi application. I need to know the definition of _TP_POOL. I looked into winnt.h and found the following typedef declaration:

typedef struct _TP_POOL TP_POOL, *PTP_POOL; 

I can't find the _TP_POOL on my local header files. Which is the location of it?

like image 742
EProgrammerNotFound Avatar asked May 02 '14 13:05

EProgrammerNotFound


1 Answers

The PTP_POOL is an opaque pointer. You never get to know, or indeed need to know, what that pointer refers to. The thread pool API serves up PTP_POOL values when you call CreateThreadpool. And you then pass those opaque pointer values back to the other thread pool API functions that you call. The thread pool API implementation knows what the pointer refers to, but you simply do not need to.

In Delphi I would declare it like this:

type
  PTP_POOL = type Pointer;

I'm declaring this as a distinct type so that the compiler will ensure that you don't assign pointers to other types to variables of type PTP_POOL.

like image 66
David Heffernan Avatar answered Oct 17 '22 21:10

David Heffernan