Patent ID: 6415334
Filing Date: 2002-07-02
Classification: G06F

Abstract:
A method in a computer system for accessing objects of varying thread types from a program written in a language that does not support objects of varying thread types, the thread types including thread-safe and not thread-safe objects, the method comprising:creating a plurality of threads within a process, one thread being designated as an apartment thread, the apartment thread for receiving messages to instantiate objects and to invoke methods of the instantiated objects; when the program designates to instantiate an object, intercepting the designation; instantiating a wrapper object, the wrapper object containing a reference to the instantiated object and an indication of whether the object is thread-safe or not thread-safe; determining in response to the designation and the wrapper object the thread type of the object being instantiated; when the thread type is not thread-safe, sending a message to the appropriate thread to instantiate the object; and when the thread type is thread-safe, instantiating the object within the currently executing thread; and when the program designates to invoke a method of the instantiated object, detecting the invocation; determining in response to the invocation and the wrapper object the thread type of the object whose method is being invoked; when the thread type is not thread-safe, sending a message to the appropriate thread to invoke the method of the instantiated object; and when the thread type is thread-safe, invoking the object within the currently executing thread.