> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IWorkProcessControl Interface

This interface is used by a work process to control whether its parent process is alive. This interface can be requested from the [**OutprocLoader**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/outprocloader.md) object in order to:

* obtain the ID of the host process,
* manage the priority of the work process (by default it is Below Normal),
* set the identifier of the parent process.

When a process finishes normally, all COM objects are released and work processes hosting these objects also finish normally. If process terminates abnormally (hard exception or manually killed) the COM objects are not released and work process will remain loaded. To address this issue and make your server more robust you can make the work process watch if its parent process is still alive and terminate if not.

## Methods

| **Name** | **Description** |
| - | - |
| [**GetWorkProcessId**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/iworkprocesscontrol-getworkprocessid.md) | Returns the ID of the process which hosts FlexiCapture SDK. The program which uses FlexiCapture SDK can control whether the host process is alive and can terminate the process if necessary. **Note:** It is important to obtain the identifier of the process first, and only then start the work with FlexiCapture SDK. This is due to the fact that all FlexiCapture SDK method calls are performed sequentially, therefore, when FlexiCapture SDK is not responding, the call to this method will remain in the queue and will not finish too. |
| [**SetParentProcessId**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/iworkprocesscontrol-setparentprocessid.md) | Sets the identifier of the parent process for the work process. When the parent process terminates all its work processes will also terminate. |
| [**SetPriorityClass**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/iworkprocesscontrol-setpriorityclass.md) | Sets the priority class for the work process. |

## Samples

> [accordion] C# code
>
> ```csharp theme={null}
> IEngineLoader engineLoader = new FCEngine.OutprocLoader();
> IWorkProcessControl workProcess = (IWorkProcessControl)engineLoader;
> workProcess.SetParentProcessId( Process.GetCurrentProcess().Id );
> ```

## See also

[**OutprocLoader**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/outprocloader.md)

[Different Ways to Load Engine Object](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/differentwaystoloadengine.md)

[Using](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/usinginserverapplications.md) [ABBYY FlexiCapture SDK](https://docs.abbyy.com/flexi-capture/sdk/api-reference/errorcodes.md) [in Multi-Threaded Server Applications](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/usinginserverapplications.md)
