| Dart Home | PowerTCP Mail for ActiveX | Custom Development | Reply | PowerTCP Mail for ActiveX Topics | Forums |
| Author | Forum: PowerTCP Mail for ActiveX Topic: Should we change the threading model for these dlls? |
| amenon From: BELLEVUE, WA USA Posts: 1 Member Since: 05/02/07 |
posted May 2, 2007 7:46 PM The dlls in question are: DatMail.dll, DartSock.dll and DartUtil.dll. Traditionally we always install these dlls and then change their ThreadingModel in the registry from 'Both' to 'Apartment'. Dont know whether you guys recommended this some time back? The guys who worked in this area no longer work here, so there is no way to find out. Turns out that now we experience problems on some Win 2003 Server machines when the threading model is 'Apartment'. If we re-register the dlls, our application starts working properly. I am trying to find out if we should just let it register as 'Both' since that is also the default? But I also do not want to re-introduce any older problems which were getting fixed by having the threading model set to 'Apartment'. Do you see any reason why the threading model would be 'Apartment'? Are these dlls written with adequate data-protection when a single object is called from multiple threads? |
| Raj From: Rome, NY, USA Posts: 389 Member Since: 02/01/06 |
posted May 3, 2007 3:25 PM Please check my email. -Raj |
| Arjun From: Rome, NY, USA Posts: 137 Member Since: 09/17/07 |
posted February 6, 2008 3:46 PM Hello, Here is final resolution over the email: Threading Model Most PowerTCP controls are marked as 'Both', allowing them to be created in both Single-threaded Apartments (STAs) and Multi-threaded Apartments (MTAs). PowerTCP controls are not thread-safe, however, so users need to provide synchronization mechanisms if multiple threads are accessing the same instance of a control. When a PowerTCP control is registered, registry entries are added that indicate the controls can be created and used in STAs and MTAs. These entries can be modified, if desired, to force various COM hosting applications to manage the controls differently. PowerTCP controls are "pooled components" to take advantages of the object pooling features of COM+. Single-threaded Applications Most application developers develop single-threaded applications (the application has only one STA). Most of the sample applications included with PowerTCP Controls are written using this model. When Timeout is greater than 0, the communication components process Windows messages for the thread, allowing the user interface and all other windows to function normally. Multi-threaded Applications In Visual Basic you can make a multi-threaded application by creating an ActiveX executable with special objects that are created using CreateObject(). The WebServer application, included with PowerTCP Winsock for ActiveX, was written using this technique. Each connection is managed within a unique STA, so busy threads do not interfere with the main STA that processes user interface messages and windows. In C++ you can make a multi-threaded application using the CoInitializeEx(NULL, COINIT_MULTITHREADED) method. PowerTCP controls are marked as 'Both', so they can be created in an MTA, but no synchronization mechanisms are in place. Typically, applications will access each PowerTCP control on only one thread, so synchronization is not necessary. NOTE: Although Microsoft guidance indicates that COM objects marked as "Both" (for use in STAs and MTAs) should provide thread-safety (for the MTA), PowerTCP does not because the typical usage is to make blocking calls on a single thread within an MTA. If thread-safety is necessary, it is up to the application developer to provide it. Regards, Arjun |
| Reply | PowerTCP Mail for ActiveX Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|