Customarily, callbacks take an additional user data parameter so that closures can be used as callbacks. This is the case with, for example, `JsMemoryAllocationCallback`. However, `JsThreadServiceCallback` takes no such parameter (do not confuse this with its `callbackState` parameter, which is not _user_ data rather engine-provided data for the work item callback).

Ideally the API would be:

```c
typedef bool (CALLBACK *JsThreadServiceCallback)(
    _In_ JsBackgroundWorkItemCallback workItemCallback,
    _In_opt_ void *workItemCallbackState,
    _In_opt_ void *threadServiceCallbackState
);

STDAPI_(JsErrorCode) JsCreateRuntime(
    _In_ JsRuntimeAttributes attributes,
    _In_opt_ JsThreadServiceCallback threadService,
    _In_opt_ void *threadServiceCallbackState
    _Out_ JsRuntimeHandle *runtime
);
```

where the runtime would pass `threadServiceCallbackState` to `threadService` whenever it’s called.
No way to pass user data to thread service callback
This is a GitHub Issue
repo:ChakraCore
owner:chakra-core
Title : No way to pass user data to thread service callback
Issue date:

--- start body ---
Customarily, callbacks take an additional user data parameter so that closures can be used as callbacks. This is the case with, for example, `JsMemoryAllocationCallback`. However, `JsThreadServiceCallback` takes no such parameter (do not confuse this with its `callbackState` parameter, which is not _user_ data rather engine-provided data for the work item callback).

Ideally the API would be:

```c
typedef bool (CALLBACK *JsThreadServiceCallback)(
    _In_ JsBackgroundWorkItemCallback workItemCallback,
    _In_opt_ void *workItemCallbackState,
    _In_opt_ void *threadServiceCallbackState
);

STDAPI_(JsErrorCode) JsCreateRuntime(
    _In_ JsRuntimeAttributes attributes,
    _In_opt_ JsThreadServiceCallback threadService,
    _In_opt_ void *threadServiceCallbackState
    _Out_ JsRuntimeHandle *runtime
);
```

where the runtime would pass `threadServiceCallbackState` to `threadService` whenever it’s called.
--- end body ---

None