Class TaskPoolGlobalHook
Represents a task pool-based implementation of IGlobalHook.
Inherited Members
Namespace: SharpHook
Assembly: SharpHook.dll
Syntax
public sealed class TaskPoolGlobalHook : GlobalHookBase, IGlobalHook, IDisposable
Remarks
The event handlers will run with the specified parallelism level on separate threads inside the default thread pool for tasks. This way the hook itself will not be blocked if the handlers are long-running. The exception is the HookDisabled event which will run on the same thread that called the Dispose() method since at that point it doesn't matter anymore that the hook is not blocked.
Setting SuppressEvent inside the handlers will have no effect as they are run on other threads.
Constructors
| Improve this Doc View SourceTaskPoolGlobalHook()
Initializes a new instance of TaskPoolGlobalHook.
Declaration
public TaskPoolGlobalHook()
Remarks
Calling this constructor is the same as passing Sequential to the other constructor.
TaskPoolGlobalHook(TaskPoolGlobalHookOptions)
Initializes a new instance of TaskPoolGlobalHook.
Declaration
public TaskPoolGlobalHook(TaskPoolGlobalHookOptions options)
Parameters
Type | Name | Description |
---|---|---|
TaskPoolGlobalHookOptions | options | The options of the hook which include its parallelism level. |
Methods
| Improve this Doc View SourceDispose(Boolean)
Destoys the global hook.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing | true if the method is called from the Dispose() method. Otherwise, false. |
Overrides
Remarks
After calling this method, the hook cannot be started again. If you want to do that, create a new instance of IGlobalHook.
Exceptions
Type | Condition |
---|---|
HookException | Stopping the hook has failed. |
HandleHookEvent(ref UioHookEvent)
Handles the hook event.
Declaration
protected override void HandleHookEvent(ref UioHookEvent e)
Parameters
Type | Name | Description |
---|---|---|
UioHookEvent | e | The event to handle. |