multithreading - Must initialize the COM (out-of-proc) within the object created? -


i created windows nt service, exports com interface using atl (out-of-proc com), api calls coinitializeex (0, coinit_multithreaded) in ctor(), couninitialize () in dtor() of class of object?

reading fashionable app designers agree: free threading model what's hot fall , give activex-based web pages boost apartment threading model did nothing clarify.

my atl project have declaration of :

 #define _atl_free_threaded 

for out-of-process atl server that's taken care of catlexemodulet constructor. call initializecom() in constructor. when you've #defined _atl_free_threaded, automatically produce call coinitializeex(null, coinit_multithreaded), you'd expect. code easy find in vc/atlmfc/include/atlbase.h

interface method calls made stub rpc thread, actual thread makes call entirely unpredictable. pretty dangerous because rpc recycles threads , calls made same thread. not always, depending on how many concurrent calls being processed. burden of supporting free threading ensure code entirely thread-safe. if have bugs of deadlock or threading race kind or rely on synchronization object has thread-affinity mutex across multiple calls won't ruin day until server gets heavily loaded. sure test this.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -