EProgrammerNotFound
EProgrammerNotFound

Reputation: 2461

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?

Upvotes: 6

Views: 846

Answers (3)

Deduplicator
Deduplicator

Reputation: 45674

_TP_POOL is an incomplete type, which is never completed in the public headers.

This is a common C and C++ idiom for type-safe opaque handles.
In other words, they are used to completely hide the implementation.

The probably best-known example is FILE.

Upvotes: 3

selbie
selbie

Reputation: 104559

It's not defined. But given that TP_POOL is always passed around via pointer (PTP_POOL), you don't need to know its exact internals. Just treat PTP_POOL as if was declared as a VOID* reference.

Upvotes: 3

David Heffernan
David Heffernan

Reputation: 613262

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.

Upvotes: 4

Related Questions