Question:
Can someone please give me a specific example in which you would use threading in an application.?
1970-01-01 00:00:00 UTC
Can someone please give me a specific example in which you would use threading in an application.?
Eight answers:
Franzi
2006-10-13 05:21:21 UTC
we can take MS-Word as a example for multithreaded application, where while u r typing some information, a thread check for spelling, a thread will change case of characters, and another thread takecare of indentation
2016-03-28 11:19:56 UTC
Christians who take the bible word for word and as the word of god, what do you have to say about this. Do you know what a covenant is? This is all in relation to the "old" covenant, which was a legally binding agreement between the two parties, God and the Israelites. Christians are not a party to this old covenant, and this old covenant came to an end. You cannot be held to the conditions of a covenant you are not a party to. .
Special Ed
2006-10-13 07:21:55 UTC
You can try a TCP/IP multi-socket winsock server that accepts multiple connections.



What it basically did : throughout the night multiple remote sites would connect to the server, exchange data, check for updates and then log off. At any one time 10 connections could be active and exchanging actions (aka running on multiple threads).



Hope that helps! It is a lot more complicated then that of course.
2006-10-13 05:56:56 UTC
Most programs that print use a thread to deal with printing - it stops the app from freezing up while it prints. Look at MS Word - load a big document and hit print. You can carry on working straight away, but in the bar at the bottom you can see a little icon to show you that the print thread is active.



Rawlyn.
poorcocoboiboi
2006-10-13 05:14:08 UTC
Asynchronous actions are at the heart of AJAX web applications. They work by starting a thread which communicates with the server, receives a response and grafts that into the web page without reloading the page.
smiley
2006-10-13 05:31:58 UTC
u can try developing an application for a clock
Colorado
2006-10-13 05:14:02 UTC
Needling.
2006-10-13 05:23:48 UTC
hi , Threading tips



The ActiveX to Enterprise Java Beans (EJB) bridge supports both free-threaded and apartment-threaded access and implements the Free Threaded Marshaler to work in a hybrid environment such as Active Server Pages (ASP). Each thread created in the ActiveX process is mirrored in the Java environment when the thread communicates through the ActiveX to EJB bridge. In addition, once all references to Java objects (there are no JObjectProxy or JClassProxy objects) are loaded in an ActiveX thread, the ActiveX to EJB bridge detaches the thread from the Java virtual machine (JVM) code. Therefore, you must be careful that any Java code that you access from a multithreaded Windows application is thread safe. Visual Basic code and VBScript applications are both essentially single threaded. Therefore, Visual Basic and VBScript applications do not have threading issues in the Java programs they access. Active Server Pages and multithreaded C and C++ programs can have issues.



Consider the following scenario:



1. A multithreaded Windows Automation Container (our ActiveX Process) starts. It exists on Thread A.

2. The ActiveX Process initializes the ActiveX to EJB bridge, which starts the JVM code. The JVM attaches to the same thread and internally calls it Thread 1.

3. The ActiveX Process starts two threads: B and C.



4. Thread B in the ActiveX Process uses the ActiveX to EJB bridge to access an object that was created in Thread A. The JVM attaches to thread B and calls it Thread 2.



5. Thread C in the ActiveX Process never talks to the JVM code, so the JVM never needs to attach to it. This is a case where the JVM code does not have a one-to-one relationship between ActiveX threads and Java threads.



6. Thread B later releases all of the JObjectProxy and JClassProxy objects that it used. The Java Thread 2 is detached.



7. Thread B again uses the ActiveX to EJB bridge to access an object that was created in Thread A. The JVM code attaches again to the thread and calls it Thread 3.



ActiveX process JVM access by ActiveX process

Thread A - Created in 1 Thread 1 - Attached in 2

Thread B - Created in 4 Thread 2 - Attached in 4, detached in 6 Thread 3 - Attached in 7

Thread C - Created in 4



Threads and Active Server Pages



Active Server Pages (ASP) in Microsoft Internet Information Server is a multithreaded environment. When you create the XJB.JClassFactory object, you can store it in the Application collection as an Application-global object. All threads within your ASP environment can now access the same ActiveX to EJB bridge object. Active Server Pages by default creates 10 Apartment Threads per ASP process per CPU. This means that when your ActiveX to EJB bridge object is initialized any of the 10 threads can call this object, not just the thread that created it.



If you need to simulate single-apartment behavior, you can create a Single-Apartment Threaded ActiveX dynamic link library (DLL) in Visual Basic code and encapsulate the ActiveX to the EJB bridge object. This encapsulation guarantees that all access to the JVM object is on the same thread. You need to use the tag to assign the XJB.JClassFactory to an Application object and must be aware of the consequences of introducing single-threaded behavior to a Web application.



The Microsoft KnowlegeBase has several articles about ASP and threads, including:



Q243543 INFO: Do Not Store STA Objects in Session or Application

Q243544 INFO: Component Threading Model Summary Under Active Server Pages

Q243548 INFO: Design Guidelines for VB Components Under ASP.



What you should know about running scripts and ActiveX controls in Internet Explorer

Be cautious about allowing Web sites to run scripts or ActiveX controls on your computer. While these items can enhance Web browsing, they can also be a security risk, and it’s best to avoid using them when you can. However, some Web sites or tasks might require them and you will have to decide whether to trust ActiveX controls that Internet Explorer blocks for your safety.



What are scripts and ActiveX controls?



Scripts, ActiveX controls, and other Web browser add-ons are used extensively on the Internet. They can make browsing more enjoyable by providing toolbars, stock tickers, video, animated content, and more. These programs can, however, malfunction or give you content you don’t want. In some cases, these programs can be used to collect information from your computer in ways you might not approve of, possibly damage data on your computer, install software on your computer without your consent, or allow someone else to control your computer remotely. Given these risks, you should only install these programs if you completely trust the publisher.



What should you do about ActiveX controls and scripts running on your computer?



Use the default security settings in Internet Explorer. These settings will help protect you. If you feel like you need more protection while browsing the Internet, it's OK to increase your browser’s default security settings.



Important



The default security settings in Internet Explorer are designed to help protect your computer from viruses and attacks over the Internet. Microsoft strongly recommends that you leave these security settings at their default level or higher.

This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...