What are STA And MTA in threading?

Answers were Sorted based on User's Feedback



What are STA And MTA in threading?..

Answer / kiran kumar reddy

The Thread will create and enter a multi threaded apartment.
The Thread will create and enter a Single threaded apartment.

An apartment is a logical container within a process for
objects sharing the same thread access requirements. All
objects in the same apartment can receive calls from any
thread in the apartment. The .NET Framework does not use
apartments, and managed objects are responsible for using
all shared resources in a thread-safe manner themselves.

Because COM classes use apartments, the common language
runtime needs to create and initialize an apartment when
calling a COM object in a COM interop situation. A managed
thread can create and enter a single-threaded apartment
(STA) that allows only one thread, or a multithreaded
apartment (MTA) that contains one or more threads. You can
control the type of apartment created by setting the
ApartmentState property of the thread to one of the values
of the ApartmentState enumeration. Because a given thread
can only initialize a COM apartment once, you cannot change
the apartment type after the first call to the unmanaged code.

Is This Answer Correct ?    13 Yes 8 No

What are STA And MTA in threading?..

Answer / guest

Mahesh, An Advice for you

LEAVE SOFTWARE DEVELOPMENT LINE

Is This Answer Correct ?    7 Yes 2 No

What are STA And MTA in threading?..

Answer / guest

wow... great answer Mahesh, where have u been?

Is This Answer Correct ?    3 Yes 7 No

What are STA And MTA in threading?..

Answer / mahesh chandra

Single Threaded Apartment and Multy Threaded Apartment

Is This Answer Correct ?    1 Yes 18 No

Post New Answer

More C Sharp Interview Questions

FOR EXAMPLE : CLASS Dotnet { } creating object: Dotnet dn=new Dotnet(); NOW THE QUESTION IS WHICH IS CALLED AS OBJECT ?EITHER dn OR new Dotnet() and CAN YOU PROVE YOUR ANSWER?????PLEASE REPLY...

1 Answers  


Can I call a virtual method from a constructor/destructor?

1 Answers  


i need to insert data into sql server table emp through textboxes txtname and txtsalary using c# code. Please help

1 Answers  


Can we declare private class in c#?

1 Answers  


What are the concepts of dispose method?

1 Answers  


Are cao stateful in nature?

1 Answers  


Write a program in c# to find the angle between the hours and minutes in a clock?

1 Answers  


How do you remove the objects which are not in use?Explicitly or implicitly?What is the exact mechanism going behind?

2 Answers   Advanced Software Systems, Choice Solutions,


What is a streamwriter in c#?

1 Answers  


How do you generate documentation from the C# file commented properly with a command-line compiler?

2 Answers  


What is callback delegate in c#?

1 Answers  


What are the types in c#?

1 Answers  


Categories