Share via


Shared Thread Pool

Only the HCI layer maintains two persistent threads; write and read. Other layers borrow threads from the top or bottom layers of the stack as they are called with commands and events.

To increase the efficiency and facilitate shutdown logic, thread layers are discouraged from maintaining their own thread pools as well as creating new threads using the CreateThread mechanism.

The Bluetooth stack provides a shared thread pool accessible through the following set of functions.

SVSCookie btutil_ScheduleEvent (
    LPTHREAD_START_ROUTINE pfn,
    LPVOID lpParameter,
    unsigned long ulDelayTime
);
int btutil_UnScheduleEvent (SVSCookie ulCookie);

By using these functions, stack layers are guaranteed the threads will be properly stopped before the stack is unloaded.

See Also

Common Layer Characteristics | Bluetooth Protocol Stack

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.