I'm creating a custom charting control and I would like to have the possibility of displaying some sort of wait bar while other commands are running (i.e. chart is being created).
I'm using ProgressBar (System.Windows.Forms.ProgressBar in marquee mode) as a part of this control. I do not need to update the state of the progress bar, I ...
I would like 3 Threads in Python to run for n seconds. I want to start them all at the same time and have them finish at the same time (within milliseconds). How do I do this?
threading.Timer only starts after the previous one has been completed.
...
I'm using Timer as an process interrupt mechanism. The flow of logic is as follows:
T0: create new timer at T0 and schedule a new timer task to execute at T2 (1 second task delay, task is very simple - sets a flag variable)
T1: in the main calling thread, sleep for 5 seconds
T2: in the timer thread, task executes
T5: sleep finishes
...
i have this code:
Thread[] threadsArray = new Thread[4];
for (int i = 0; i < 4; i++)
{
threadsArray[i] = new Thread(() => c1.k(i));
}
for (int i = 0; i < 4; i++)
{
threadsArray[i].Start();
}
for (int i = 0; i < 4; i++)
{
threadsArray[...
I've been trying to use Java's ProcessBuilder to launch an application in Linux that should run "long-term". The way this program runs is to launch a command (in this case, I am launching a media playback application), allow it to run, and check to ensure that it hasn't crashed. For instance, check to see if the PID is still active, an...
Hi,
I am trying to put together a UDP server with a wxPython GUI.
Here is a link to the code:
UDP Server pastie.org
I have linked it as its pretty lengthy. I have successfully got the UDP server running on the thread but I can not figure out how to close the socket when the stopping the thread.
At the moment it will kick up a new t...
I am trying to figure out how to start and stop a serial interface.
class SerialInterface implements Runnable{
// Stream from file
@Override
public void run(){
try {
startInterface();
} catch (IOException ex) {
Logger.getLogger(SerialInterface.class.getName()).log(Level.SEVERE, null, ex);
...
I'm having a little trouble figuring out how to call the Parallel.ForEach with a 2D array of strings:
string[,] board = new string[,]{
{"A", "B", "C", "D", "E" },
{"F", "G", "H", "I", "J"},
{"K", "L", "M", "N", "O"},
{"0", "1", "2", "3", "4"}};
Parallel.ForEach(board, row =>
{
for (int i = 0;...
I am trying to take a Perl program I wrote and thread it. The problem is I read that some modules aren't "thread safe". How do I know if a module is thread safe? I've looked around for a list and cannot locate one.
To test out one module I use frequently (Text::CSV_XS) I tried the following code out:
use strict;
use warnings;
use th...
Hi ,
Please explain Thread Pool and what is the use of Thread pool,please give me a real time example?
...
Hi,
I have a situation where I would like to have the main thread waiting, while other threads can invoke on the main thread, without calling Application.Run.
The following code shows what I try to achieve, except that the main thread and the data loading thread are causing a dead lock.
static class Program
{
/// <summary>
...
hi, i am working upon serversocket class and opening threads when a new client hits the serversocket....
serverSocket = new ServerSocket(port);
while (true) {
Socket clientSocket = serverSocket.accept();
new Thread(this).start();//opening multiple threads
}
but when 5000 clients hits on this serversocket an error come...
I'm using Twitter4j in asynchronous mode. When I get response in Listener I want to be able to change some Views in my Activity but it results in CalledFromWrongThreadException.
I know that I can use runOnUiThread method, but what is the most elegant solution for this apart from inlining Runnable Classes?
Part of my Activity:
Twi...
This is a follow-on from:
http://stackoverflow.com/questions/3264245/debugging-a-multithreaded-c-c-cli-c-solution-in-visual-studio-2008-what
Please excuse the format, I've just repeated some of the description of the application here:
I've inherited a project consisting of three levels of code. The lowest layer is native C++ that inte...
Hi,
I am using the Background worker thread in a Silverlight 4 application. In the ProgresssChanged event handler, I can make calls to the Silverlight UI, but how does this work ? Isn't the background worker thread that fires the ProgressChanged event on a different thread from the Silverlight UI thread ? If so, I thought updating th...
I am getting this following error during run time.
ERROR: thread attach failed
My project contains two classes in src as fallowing:
Activity class
video_thread class
I've created an object for this video_thread class in Activity class, made it Daemon and started it like this:
video_thread v=new video_thread();
video_thraed.setDae...
hi,
i've panel which contains a text field for entering number and a submit button
sometimes new (updated) value can not be sent when i click the button (the previous value of the field is sent)
in the debug mode, i see that sometimes
AbstractButton.fireActionPerformed()
is called (which gets the value of the field at that time ...
The title pretty much says it. I have some methods that need to run on a new thread and since all the code before creating the thread is pretty much the same, I thought I would create a function that could take as a parameter the Action I need to invoke.
Problem is, I have not found how to tell the thread that it needs to execute the Ac...
I have some legacy code that uses Interlocked.Equals to compare values. The values may be two bools or it may compare an array of structs to null. Resharper complains about Interlocked.Equals saying "access to a static member of a type via a derived type". I know that Equals is not a member of the Interlocked class, but rather is a mem...
Lets say i have a Poco::Thread:
Thread Parent has an eventhandler method within it.
The parent then spawns two children threads, who are given events that are the parent subscribes the eventhandler to.
So two events both have the same event handler attached.
If Child A triggers their event, and Parent starts to execute it, what would hap...