Location: Symbol Reference > Classes > TJwJobObjectSessionList Class > TJwJobObjectSessionList Methods > AssignProcessToJob Method > TJwJobObjectSessionList.AssignProcessToJob Method (TJwProcessHandle, Pointer)
JWSCL Documentation
ContentsIndexHome
PreviousUpNext
TJwJobObjectSessionList.AssignProcessToJob Method (TJwProcessHandle, Pointer)
Pascal
procedure AssignProcessToJob(Process: TJwProcessHandle; Data: Pointer); virtual; overload;
Parameters 
Description 
Process: TJwProcessHandle 
defines a process handle to be added to an job object 

AssignProcessToJob adds a process to a job using the process' session id to determine which job object must be used. If the job object with the neccessary session id is not available it will be created. For this task the event OnNewJobObject must be set. OnNewJobObject will be called for every job object that must be created. E.g. if the job object list contains no jobs (Count = 0) and a job with session ID 2 is to be assigned, the event OnNewJobObject is called 3 times (session 0,1,2) and the process is assigned to the job object with index 2. 

The assignment is threadsafe to avoid complication with other methods. 

 

Exceptions 
Description 
will be raised if event OnNewJobObject is nil 
will be raised if the job object pointer returned by OnNewJobObject is nil 
can be raised if the call to an winapi function failed. 
Copyright (c) 2010. All rights reserved.
This help was created by Doc-O-Matic sponsored by toolsfactory software inc.
What do you think about this topic? Send feedback!