[This is preliminary documentation and subject to change.]
The JOBOBJECT_ASSOCIATE_COMPLETION_PORT structure contains information used to associate a completion port with a job object.
typedef struct _JOBOBJECT_ASSOCIATE_COMPLETION_PORT {
PVOID CompletionKey;
HANDLE CompletionPort;
} JOBOBJECT_ASSOCIATE_COMPLETION_PORT, PJOBOBJECT_ASSOCIATE_COMPLETION_PORT;
The job object sends messages to the completion port when certain events occur. All messages are sent directly from the job object as if the job object had called the PostQueuedCompletionStatus function. A thread monitoring the completion port using the GetQueuedCompletionStatus function must pick up the messages. The thread receives information in the GetQueuedCompletionStatus parameters shown in the following table.
Parameter | Information Received |
---|---|
lpCompletionKey | The value specified in CompletionKey during the completion-port assocation. If a completion port is associated with multiple job objects, CompletionKey should help the caller determine which completion port is sending a message. |
lpOverlapped | Message-specific value. For more information, see the following table of message identifiers. |
lpNumberOfBytesTransfered | The message identifier that indicates which job-related event occurred. For more information, see the following table of message identifiers. |
The following messages can be sent to the completion port.
Message Identifier | Description |
---|---|
JOB_OBJECT_MSG_END_OF_JOB_TIME | Indicates that the JOB_OBJECT_POST_AT_END_OF_JOB option is in effect and the end-of-job time limit has been reached. Upon posting this message, the time limit is canceled and the job's processes can continue to run. The value of lpOverlapped in NULL. |
JOB_OBJECT_MSG_END_OF_PROCESS_TIME | This message is sent whenever a process exceeds a per-process time limit. It is sent after the process termination has been requested. The value of lpOverlapped is the identifier of the process that exceeded its limit. |
JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT | This message is sent when the active process limit has been exceeded. The value of lpOverlapped is NULL. |
JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO | This message is sent whenever the active process count is decremented to 0. For example, if the job currently has two active processes, this message is sent after they both terminate. The value of lpOverlapped is NULL. |
Windows NT: Requires version 5.0 or later.
Windows: Unsupported.
Windows CE: Unsupported.
Header: Declared in winnt.h.
Processes and Threads Overview, Process and Thread Structures, PostQueuedCompletionStatus, QueryInformationJobObject, SetInformationJobObject