Previous Table of Contents Next


22.9.3 associated_handler


   If the associated_handler is set to nil, the polling model is used to obtain the reply to the request. If it is non-nil, the associated ReplyHandler is invoked when a reply becomes available.

   Switching between the callback and polling models is supported by this specification. The request must be made using the polling model, and thus a Poller is obtained. Through the attribute associated_handler, a ReplyHandler may be registered. When the reply is available, the associated ReplyHandler will be invoked just as if the callback model had been used to make the original request. By setting the attribute to nil, the ReplyHandler can be disassociated at any time to allow the client application to resume use of the Polling model. The Poller implementation is responsible for ensuring that in multi-threaded applications, access to the associated_handler is multi-thread safe.