Table of Contents

Class TaskPoolGlobalHook

Namespace
SharpHook
Assembly
SharpHook.dll

Represents a task pool-based implementation of IGlobalHook.

public sealed class TaskPoolGlobalHook : GlobalHookBase, IGlobalHook, IDisposable
Inheritance
TaskPoolGlobalHook
Implements
Inherited Members

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

TaskPoolGlobalHook()

Initializes a new instance of TaskPoolGlobalHook.

public TaskPoolGlobalHook()

Remarks

Calling this constructor is the same as passing Sequential to the other constructor.

See Also

TaskPoolGlobalHook(IGlobalHookProvider)

Initializes a new instance of TaskPoolGlobalHook.

public TaskPoolGlobalHook(IGlobalHookProvider globalHookProvider)

Parameters

globalHookProvider IGlobalHookProvider

The underlying global hook provider.

Exceptions

ArgumentNullException

globalHookProvider is null.

See Also

TaskPoolGlobalHook(IGlobalHookProvider, TaskPoolGlobalHookOptions)

Initializes a new instance of TaskPoolGlobalHook.

public TaskPoolGlobalHook(IGlobalHookProvider globalHookProvider, TaskPoolGlobalHookOptions options)

Parameters

globalHookProvider IGlobalHookProvider

The underlying global hook provider.

options TaskPoolGlobalHookOptions

The options of the hook which include its parallelism level.

Exceptions

ArgumentNullException

globalHookProvider or options is null.

See Also

TaskPoolGlobalHook(TaskPoolGlobalHookOptions)

Initializes a new instance of TaskPoolGlobalHook.

public TaskPoolGlobalHook(TaskPoolGlobalHookOptions options)

Parameters

options TaskPoolGlobalHookOptions

The options of the hook which include its parallelism level.

Exceptions

ArgumentNullException

options is null.

See Also

Methods

Dispose(bool)

Destoys the global hook.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true if the method is called from the Dispose() method. Otherwise, false.

Remarks

After calling this method, the hook cannot be started again. If you want to do that, create a new instance of IGlobalHook.

Exceptions

HookException

Stopping the hook has failed.

See Also

HandleHookEvent(ref UioHookEvent)

Handles the hook event.

protected override void HandleHookEvent(ref UioHookEvent e)

Parameters

e UioHookEvent

The event to handle.

See Also

See Also