Microsoft SDK for Java

startMTAThread

This method of the ComLib Class is similar to the java.lang.Thread.start method. The difference is that Thread.start initializes the thread as a separate single-threaded COM apartment, while startMTAThread initializes the thread inside the multi-threaded COM apartment.

This method replaces ThreadStartMTA, which did not automatically call CoInitializeEx and is now deprecated. startMTAThread calls CoInitializeEx automatically. If you use threadStartMTA and use Microsoft® J/Direct™ to call CoInitializeEx, the Microsoft VM detects this and tags the thread as being inside the MTA to allow proper marshaling.

Syntax

public static native void startMTAThread(Thread thd);

Parameters

thd The Thread to start.

Exceptions

IllegalThreadStateException if the thread was already started.

See Also

java.lang.Thread.run()

java.lang.Thread.stop()

Remarks

This method was added as of versions 2925 through 3167 of the Microsoft virtual machine.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.