Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / December 2003

Tip: Looking for answers? Try searching our database.

Multi-threaded apartment model in C# COM objects

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sharanga Dayananda - 08 Dec 2003 16:27 GMT
Hi

I have a COM object written in C#, which I'm having trouble with.

It is a database access library which is being called from unmanaged
C++.

Unfortunately, I don't seem to be able to call multiple instances of the
object from within a multi-threaded C++ app.

Only one thread appears to work with the others failing.

I don't seem to be able to find any info. on MTA for C# objects.
However, I seem to remember reading that C# COM objects are by default
MTA.

Thanks in advance.
Sharanga Dayananda
Dave Purrington - 08 Dec 2003 18:54 GMT
Have you designed your object to be threadsafe?

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/c
pconthreadingdesignguidelines.asp


Even if you don't have synchronization issues in your own code, it says
this:

"the .NET Framework class libraries are not thread safe by default"

I think the fact that the other threads are "failing" is an indication that
your object is in actuality executing in a MT environment.  Otherwise,
they'd queue up to execute serially.

Hope this helps.

D
> Hi
>
[quoted text clipped - 14 lines]
> Thanks in advance.
> Sharanga Dayananda
Sharanga Dayananda - 09 Dec 2003 09:11 GMT
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/c
pconthreadingdesignguidelines.asp

No, my db lib isn't thread safe.

Thanks.

Sharanga

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.