I am using a QTimer and connecting its timeout signal to the method animate(). In animate(), I am displaying a QPushButton at different positions using a loop. The problem is that the QPushButton is not visible till the loop is finished. It should be giving the effect of a moving object. The following is Qt Jambi code :
QTimer t=new...
I am trying to solve the readers-writers problem with writer preference in Java using multi-threading. The following is a stripped down version of what my code does. Will it work?
public PriorityBlockingQueue<myClass> pq;
public void foo(){
myClass obj = new myClass();
pq.add(obj);
obj.wait();
//Actual code
}
public void...
I have an external library which has a method which performs a long running task on a background thread. When it's done it fires off a Completed event on the thread that kicked off the method (typically the UI thread). It looks like this:
public class Foo
{
public delegate void CompletedEventHandler(object sender, EventArgs e);
...
This example is JavaScript, since that's where I'm using callbacks mostly. I want to understand how they work at a low level.
In the example below, I'd expect everything to happen in order and "calling back" to occur after "step 3" and before "step 4." This makes sense to me, as everything is done in order on a single thread of execut...
Hi all,
I have several threads. And I'd like to create sub-threads in one of them. So I'd like know whether java thread has a tree structure. Or the new created sub-threads is just the sibling of other threads. And What's the resource allocation strategy when these thread are competing for resources? Does the parent thread has higher pr...
i want to know how to run any method in background...i am making app that parse xml file from internet..the file is large..so it takes 20-25 seconds to parse it and show it in table view...the problem is that when i press the button to parse the file..the button remains pressed until the file is parsed..so upto 20 sec button remains pres...
Hi
How I can get to know which thread is
waiting for more time?
My requirement is, In a synchronized methos, when one thread completes its task, I want to allow the Thread which is waiting for long time. I hope my question make sense.
...
This question is inspired by this other question.
If multiple threads are waiting on a synchronized block, and the lock becomes available, who goes first? Is it by thread priority (and then first-come-first-served)?
And do the same rules apply for notify (with multiple waiting threads)?
...
some Function()
{
for(xxxxxx){
//a infinite loop or just a long code loading an running stuff from a list
}
}
ActionListener Panic(yyyyyyyy)
{
Stops the infinite loop by list.clear() or insert some thing into the list and break the loop
}
I is trying to make a panic button to stop my code, problem is when Jav...
I have a program that has Classes
GUI
Upload
and a buffer between the 2 classes - ie used to communicate between the 2 classes .
The Upload class uses Process to run an command line FTP app. I want to return what output produced by the FTP app to be displayed in a textbox in the GUI.
I have tried using the following code that ...
Over the last couple months I've been working with programs that involve multi-threading aspects to them. Multi-threaded programs a very new to me and while I understand the crude basics, how to go about designing a multi-threaded program is still beyond my skill-set. I would like to know what resources that people have found online that...
Hi,
I know I need to use some invoke method. But how will this work in respect to object properties bound to the DataGridView? Is it possible to have the DataGridView update automatically when the property of the bound object changes, and at the same time invoke it?
The object I want to display is updated through an API event, so it ...
Hi,
In short, I've implemented a class that derives from SynchronizationContext to make it easy for GUI applications to consume events raised on threads other than the GUI thread. I'd very much appreciate comments on my implementation. Specifically, is there anything you would recommend against or that might cause problems that I haven'...
Hi there are multiple specific examples but I just wanted to have a working generic calling PHP into background example from shell_exec.
So my php function runs a large processing job.
On the top of the script (process.php) I put?
!#usr/bin/php
i think - any way to get that specific path, maybe 'which php'?
then the actual command ...
I am writing a GUI application.
The application is opening multiple threads during it's life time. One of the threads is handling events that can come from other applications, so it is waiting in a while(true) loop for the event which is never been terminated.
The user can close the application in any minute. I want to close all the t...
Our Android app does a lot of image decoding. We fetch a lot of images from the internet, local storage caches, etc.
Up to now, these images are being decoded on the UI thread (using BitmapFactory.decodeX() methods). It's been causing some timeout crashes because the UI doesn't respond quickly enough to user input.
I could write a li...
I need to know the identity of the current thread to keep track of which threads are making certain requests to a shared data structure.
...
I've got a timer that won't trigger the associated function when the time runs out. I did set a Tick event. I set the Interval property to 12000 and I did myTimerObject.Start();.
I did however set off this timer in a seperate thread (somewhere in a BackgroundWorker). My theory is that even though the timer seems to start correctly, the ...
Hello,
I have an issue with threads.
I am defining a global variable, a char * that I initialize to NULL, and a mutex.
pthread_mutex_t mutex;
char *minURLTime;
minURLTime = NULL;
Then I initialize my mutex:
pthread_mutex_init(&mutex, NULL);
I then create a new thread:
void *status;
pthread_t t;
pthread_create(&t, NULL, executeTh...
Hi there.
I am trying to write a simple TCPServer and a client with Twisted python.
Everything is working well; but, there is a way to defer some tasks to different threads? For example, is it possible to do:
take an input from the user until \n, then send the data to the server;
accept all the incoming messages from the server and wri...