Hello. As from the topic title, i am trying to work a multithread GUI where the progress bar indicates the running process completion (like we always see when we are installing/uninstalling/downloading). I've read a couple of written tutorials and some other forums discussions regarding the progress bar and multithreading. I've also even tried the simple multithreading examples given but I still don't get it especially adding the process that i want to run. This is my GUI (simple) ![window.JPG](/attachments/large/4/38a5cc286b292d70c71cda871a2d80e5.JPG "align-center") : class MyApp(QtWidgets.QMainWindow, Ui_MainWindow): def __init__(self): QtWidgets.QMainWindow.__init__(self) Ui_MainWindow.__init__(self) self.setupUi(self) self.progressBar.setVisible(False) #I WASN'T SUCCESSFULL IN MANUALLY CREATING A PROGRESS BAR BUT …

Member Avatar
Member Avatar
+0 forum 1

I am trying to learn Volatile keyword in Multi Threading and I came across this statement: *Volatile is preferred in cases when one thread reads and writes a shared variable and other threads just read the same. Whereas if there are more than 2 threads performing read and write both on the shared variable then only volatile is not enough, you need to have synchronisation as well*. I am aware of the volatility concept and synchronisation, so can someone please provide an example relating to the above statement?

Member Avatar
Member Avatar
+0 forum 1

I am trying to understand the SynchronizedMap and I ran the below code. I get the below Output with an exception. According to my understanding the exception is caused when the get() methods are trying to access the syncmap when a thread is still executing a write on the map or Thread is in the Sleep state. Is my understanding correct or am I missing something ? class MapHelper1 implements Runnable { Map<String, Integer> map; public MapHelper1(Map<String, Integer> map) { this.map = map; new Thread(this, "MapHelper1").start(); } public void run() { map.put("One", 1); try { System.out.println("MapHelper1 sleeping"); Thread.sleep(100); } catch …

Member Avatar
Member Avatar
+0 forum 1

I have two forms the first FrmRecipe.vb form has all my calulations and functions in it the second FrmReports has a crystal report viewer with loads of reports. I am trying to call the report as a thread so that the main from is still working however when the treads are complete my application closes I am calling Me.BeginInvoke(New MethodInvoker(AddressOf FrmReports.PrintMasterFormulationToprinter)) Can anyone point me in the right direction?

Member Avatar
Member Avatar
+0 forum 3

Hi Dw. I'm deeply in need of your help, I'm having a problem that is giving me a very serious problem with my code. My program is a multithreaded program and its a TCP/IP based application. Client has no problem, only a server that is being so weid to me now. The client sends signals to the server and a server will perform an action according to the client's signal, and as it's a multithreaded app the server can receive many different signals as well as many same signals at the same time. When I used Microsoft Access it was …

Member Avatar
Member Avatar
+0 forum 2

Hi everyone this is my first code snippet so be gentle.. I have written a basic client/server chat program that uses multithreading for listening and sending. I welcome any improvements or discussion... Thanks James

Member Avatar
Member Avatar
+1 forum 1

Hello, Please tell me how to implement multi threading in C++ on Ubuntu 10.10. The compiler I use is GNU 4.5.2. I have some knowledge of multi-threading in Java. Explain with some codes if possible. Or please give the URL of any useful stuff

Member Avatar
Member Avatar
+0 forum 3

I'm using Excel interop and it seems that this functionality needs to run in the User Interface thread. So I execute that from the ProgressChanged backgroundworker event. Is there a way to have the dowork event (that invoked the progress changed event) interrupt execution until the ProgressChanged event is finished? Here's how the bg is initialized: private void initializeBackgroundWorker() { bg36 = new BackgroundWorker(); bg36.DoWork += bg36_DoWork; bg36.RunWorkerCompleted += bg36_RunWorkerCompleted; bg36.WorkerReportsProgress = true; bg36.ProgressChanged += bg36_ProgressChanged; bg36.WorkerSupportsCancellation = true; } This is how the process is started: private void bg36_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker bw = (BackgroundWorker)sender; This is …

Member Avatar
Member Avatar
+0 forum 3

i write a program its output is below G:\Java\Multithreading>java NewThread Child Thread Thread[main,5,main] Main Thread 1 Child Thread 1 Main Thread 2 Main Thread 3 Main Thread 4 Main Thread 5 Main Thread Complete Child Thread 2 Child Thread 3 Child Thread 4 Child Thread 5 Child Thread Complete in this output i am confuse in this line `Child Thread Thread[main,5,main]`problem is that first `main` is the name of thread and second is `5` is priority and third `main` is confusing for me what is third `main` please clarify it

Member Avatar
Member Avatar
+0 forum 5

when we create a thread like this class Run implements Runnable{ public void run(){ //You code } } class Helloworld{ public static void main(String args[]){ Thread t1=new Thread(new Run()); Thread t2=new Thread(new Run()); } } in above code thread t1 and thread t2 is creating in `main()` method its mean that t1 and t2 is creating in main thread because every application is single threaded but I read many articles in which i read that threads is being created in process but in upper case thread is being created in main thread it is confusing for me and sorry for …

Member Avatar
Member Avatar
+0 forum 5

Hey guys, I'm interested in learning about simple multithreading in C++ for Windows. Does anyone have any reccommended tutorials/links thats quite good?

Member Avatar
Member Avatar
+0 forum 2

Further along in this code I'm trying to access processRow, which is of type DataRow, but I get a RowNotInTableException This row has been removed from a table and does not have any data. In an attempt to figure out when this data is getting deleted, I added a bunch of `cq_id = processRow["cq_id"].ToString();` throughout. See code below for where it's breaking. I also discovered that if I get rid of the Task, this error goes away, but I need that. I can't figure out why I'm getting such an exception as nowhere in the code am I deleting anything. …

Member Avatar
Member Avatar
+0 forum 1

I was reading through Javascript overview on a webiste that stated following: 1) JavaScript can not be used for Networking applications because there is no such support available. 2) JavaScript doesn't have any multithreading or multiprocess capabilities. My Questions: 1) Which kind of 'Networking Applications' are we talking about? 2) What is multithreading and multiprocessing capabilities author is talking about ? Thanx.

Member Avatar
Member Avatar
+0 forum 7

Still playing with multi-threading and Prod-Con, at this point I've been at this for days. Would love some help debugging; thanks in advance. http://pastebin.com/jhHB9kTY - Main http://pastebin.com/BZSspf3x - Consumer http://pastebin.com/ndzAADJz - Producer http://pastebin.com/p7YdzH1D - Product http://pastebin.com/rxs3WzDT - Message http://pastebin.com/JR5ywgz1 - Utiliy 2 Producers, 4 Consumers Essentially Producers push a message onto the queue, message consists of a prod obj, date obj, and region string. This sharedQueue[0] is checked by each Consumer for thier region in which case they store it in a local variable and append it to internal lists. Again thanks for the help.

Member Avatar
Member Avatar
+0 forum 6

What is the way that need to be implemented in java to make a server broadcasts a voice to multiple clients, instead of broadcast voice only to one client? for example I am doing a server which can broadcast voice to multiple clients at the same time, now my server can only broadcast to one clien.

Member Avatar
Member Avatar
+0 forum 2

Hi there, I have a piece of code that I made to handle the joining of 'characters' in to a 'raid' on a game. The program refreshes a page to check if the 'raid' is available, if it is, it 'forms' the raid and 'joins' the characters. The joining process is what I am trying to make really fast, and I have done so sucessfully with the current method used as shown below, however it is not without its problems. For a start it does strange things when outputting text results as shown in the image below. That isn't a …

Member Avatar
+0 forum 0

there are three methods called in a backgroundworker_dowork() event in c# .net 4. I want to execute three methods synchronously. that is, 2nd method will execute after 1st method is fully executed and 3rd method will execute when 2nd method is fully executed. because 2nd method can exetue properly only when 1st method is fully executed. but in the background worker all three methods are executed asynchronously that i don't want. How to solve it? Thanks in advance.

Member Avatar
Member Avatar
+0 forum 3

[CODE]/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * MainMenu.java * * Created on Feb 22, 2012, 7:28:37 PM */ package f1carracing; import java.awt.Color; import java.awt.Graphics; import java.awt.Image; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JOptionPane; /** * * @author User */ public class MainMenu extends javax.swing.JApplet { Icon icon1 = new ImageIcon("classes/image/car1.png"); private Image imageCar1; private Image imageCar2; private Image imageCar3; private Image imageCar4; private Image imageCar5; private int xcoo1 = 740, xcoo2 = 640, xcoo3 = 540, xcoo4 = 440, xcoo5 = 340; private int ycoo1 = 110, …

Member Avatar
Member Avatar
+0 forum 2

Hi, I have a MDIParent and forms that i want to show as child. But because each individual child performs heavy tasks I want each child to have it's own thread. here's what I am trying to do... [CODE] void showStartPage() { Form1 p = new Form1(); p.MdiParent = this; p.Show(); } private void ShowNewForm(object sender, EventArgs e) { Thread t = new Thread(new ThreadStart(showForm)); t.SetApartmentState(ApartmentState.STA); t.Start(); } [/CODE] Here showForm is the function that needs to be started in a new thread so that i can start a new form. But i get an exception when using the line …

Member Avatar
Member Avatar
+0 forum 1

Hey guys, I am playing with the .NET 4.0's new class Parallel. I tried to open files in a directory and calculate the total bytes of them. However when I run the code, I get a different result every time. Can you explain me the problem I have? [CODE]using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Diagnostics; using System.Runtime.Remoting.Messaging; using System.IO; using System.Drawing; namespace LearnCSharp { class Program { static long totalBytes = 0; private static object token = new object(); static void ProcessImages() { string directoryPath = @"C:\files"; string[] fileNames = Directory.GetFiles(directoryPath); if (fileNames …

Member Avatar
Member Avatar
+0 forum 5

I have a project that requires us to perform matrix multiplication via multi-threading, using the Windows API. I've got the basic code running and everything is well under sane/ideal conditions. But if my input matrices go beyond 10x10 the program ends up failing on WaitOnMultipleObjects(...) and runs the main thread through without waiting for the rest to complete computation. My solution computes for each element of the resultant matrix. Below is the code: Attached are the rest of my source files in case you want to compile it. [CODE] #include "stdafx.h" #include <cstdlib> #include <iostream> #include <Windows.h> #include <process.h> #include …

Member Avatar
+0 forum 0

I want to learn multithreading in C++. somewhere on internet I got a piece of code using popen() function of stdio.h. I just wanted to know that if this function helps in creating the new threads or it doesn't come under multithreading. Please guide me in multithreading.

Member Avatar
Member Avatar
+0 forum 1

I'm trying to do some socket programming in java. what i have is, i've written this program to create a server and client on my local machine and make separate two threads for socket input and out put in [B]Se.java[/B] file. Similarly two separate threads for socket input and output at client side in file [B]Cl.java[/B] Now, when i compile both of them they show no errors or exceptions but when i run it, the server with some exception continues but client crashes i dont know what seems to be wrong.[B]all i want to do is create two threads for …

Member Avatar
Member Avatar
+0 forum 6

[CODE]class MyThread1 implements Runnable { Thread t; MyThread1() { t = new Thread(this);//create a Thread t.start();//activate the thread } public void run() //override run() of Runnable { int i; for(i =0; i< 1000; i++) System.out.print("*"); } public static void main(String args[]) { MyThread1 m1 = new MyThread1(); int i; for(i =0; i< 1000; i++) System.out.print("="); } }[/CODE] The class creates a reference of the Thread class(Line 3). How is this possible given that Thread class is not extended by it?

Member Avatar
Member Avatar
+0 forum 1

Hi, I am working on a project which requires to update a JEditorPane or JTextField simultaneously by multiple clients. It is something like this. [B][1]. There are several users( i.e a group) with the same application which contains a JEditorPane. [2]. There is a group leader for a group( note: there is an option to be a group leader in the same application) and each an every other user( i.e group member) will be connected to the group leader via individual sockets. [3]. After connecting as a group every one can type anything into the JEditorPane and that content should …

Member Avatar
Member Avatar
+0 forum 4

Hi all, I am currently trying (and now wondering if) you can add multiple threads to a program to do the same job? Basically I am writing a web crawler for a search engine and it adds many URLs to an ArrayList which is used as a queue. I add a few links to start and open each with jsoup, checking if each link is in the queue and if not adding it (to have it's links taken out). This process works but ends up at about a queue of 3000 before it starts working down. Can I add multithreading …

Member Avatar
Member Avatar
+0 forum 7

Hi, I wanna traverse inside the file system by using threads and processes.My program has to assume the first parameter is either given as "-p" which offers a multi-process application or "-t" which runs in a multi-threaded way. The second parameter is the pathname of a file or directory. If my program gets the path of a file, it should print out the size of the file in bytes. If my program gets the path of a directory, it should, in the same way, print out the directory name, then process all the entries in the directory except the directory …

Member Avatar
+1 forum 0

I want to parse through a root folder which is entered by the user by using multi threading and multi processing at different versions.But how can I distinguish while I am parsing through a root folder whether the next is a folder or a file?To summarize I want to learn how I can distinguish the upcoming is a file or a folder.I wanna learn this because if it is a folder then I let opening this folder to a dynamically thread and/or process.If it is a file the existing thread or process can continue its work without any necessarity to …

Member Avatar
Member Avatar
+0 forum 1

This is a great example for a thread stop. Simple debugging trick for any looped process that needs the "e-brake" applied while making sure that the thread is working correctly. The idea is that you can manually stop a thread, to prevent that hanging sensation during any process. This works great with TCP and UDP protocol programs and ideal for all multi-threading programs.. feel free to implement as needed.

Member Avatar
+0 forum 0

Hey I have a program that has a webBrowser navigate through a few pages, and when it gets to the last page I set it to navigate to, checks if there is a certain string on that page. I just switched my code around to use multithreading and now the statement [CODE]If WebBrowser1.DocmentText.Contains("...") Then ... End If[/CODE] generates an InvalidCastException that says "Specified Cast is Not Valid". Anybody have an idea of why this might be happening. Here is how I start the thread (when a button is clicked) [CODE]FUBCThread.Start()[/CODE] And here is the Sub that is run [CODE]Public Sub …

Member Avatar
Member Avatar
+0 forum 6

The End.