Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Creating signals with ISignalFactory

The ISignalFactory interface enables a client to create and use signals. In multithreaded processes, clients use the ISignalFactory_CreateSignal() method to create signals. During signal creation, the client provides a previously created ISignalHandler_Notify() function to process the signal. Since multiple threads are receiving notification, and therefore multiple signal handlers are running, the signal object itself must not be destroyed while other threads may need it.

Clients in a single-threaded apartment can use the signal factory in its simplest form through the ISignalCBFactory_CreateSignal() method. During creation, the client provides a callback function to process the signal. ISignalCBFactory is not safe in a multithreaded client; it does not maintain an object reference.

ISignalCtl can be used anywhere the signal is accepted, but doing so requires some care. If a signal control to a server is passed to another client, the passing client must detach the signal using the signal control in its destructor. Failing to safely clean up introduces memory leaks and the potential for crashes.