Threading and Notifications

OLE DB Programmer's Reference

In the case of free-threaded rowset objects, IConnectionPoint should be enabled to handle apartment-model or single-thread listeners. Single-threaded listeners should always be called on their thread so that the listeners are not unduly interrupted from the wrong thread.

The creator of a rowset must use CoMarshalInterface when making the object's interfaces available to other threads. Because these are free-threaded rowsets, COM will stay out of the way. If IConnectionPoint receives an interface from IRowsetNotify and it wants to use that interface on another thread, it must also use CoMarshalInterface to move the interface to another thread. Whatever moves the interface to another thread must call CoMarshalInterface. The receiving thread doesn't just get the pointer but becomes involved by extracting the pointer through CoUnmarshalInterface.

This entails a rowset that is written internally to use multiple threads, not just to run on multiple threads. Consequently, a rowset should keep track of the threads on which a listener is connected to it.

Multiple threads

1998-2001 Microsoft Corporation. All rights reserved.



Microsoft Ole Db 2.0 Programmer's Reference and Data Access SDK
Microsoft OLE DB 2.0 Programmers Reference and Data Access SDK (Microsoft Professional Editions)
ISBN: 0735605904
EAN: 2147483647
Year: 1998
Pages: 1083

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net