Let's say I have 10 threads running simultaneously. Is there any way of calling some method when a thread finishes? I was thinking of something like:
$thread->onFinish(sub { print "I'm done"; });
...
my problem is when it tries to read the object the second time, it throws the exception
java.io.StreamCorruptedException: invalid type code: AC
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1356)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at Client.run(BaseStaInstance.java:313)
ja...
Hello,
Visual Studio C++ 2008
I am using threads. However, I have this warnings and not sure what I am doing wrong.
1. unsigned int (__stdcall *)(void *) differs in levels of indirection from 'void *(__stdcall *)(void *)'
2. _beginthreadex different types for formal and actual parameters 3
/* Function prototype */
void* WINAPI get_in...
We have a tomcat application that started crashing every 10-15 minutes after we upgraded the OS ("aptitude dist-upgrade" of the system, which is a 32-bit Debian Lenny). java didn't get upgraded.
A Full thread dump is generated in catalina.out when jvm crashes. But there is no error/exception showing in any of the threads. Does anyone k...
Hi all,
Objective:
My script will download a remote file upon form submission, since the file might be big, I would like to fork off a process and let the user go on with his/her life.
Example of a command:
wget -q --limit-rate=1k --tries=10 "http://helios.gsfc.nasa.gov/image_euv_press.jpg" -O /web/assets/content/image/image_euv_press...
In the class below, I am using a singleThreadScheduledExecutor. My question is, do I need to synchronize around the access to dummyInt and dummyBoolean?
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
public class Playground {
/**
* @param arg...
Basically I have a c# server program (a console app not in IIS) which occasionally enters deadlock.
One thing that's strange is when I attach the debugger I see 3 threads waiting on a lock but no threads (using the threads window in visual studio) inside the lock! What's going on here .... I guess the visual studio debugger is lying.
B...
Is there a way to make BaseHTTPServer.HTTPServer be multi-threaded like SocketServer.ThreadingTCPServer?
...
I am using multiple threads in my application using while(true) loop and now i want to exit from loop when all the active threads complete their work.
...
I'm trying to do something like this, where I have two loops going in seperate threads. The problem I am having is that in the main thread, when I use gets and the script is waiting for user input, the other thread is stopped to wait as well.
class Server
def initialize()
@server = TCPServer.new(8080)
run
end
...
Anybody know ,what is the logic behind Thread.sleep in java? . Are they using timer
...
I need a fast inter-thread communication mechanism for passing work (void*) from TBB tasks to several workers which are running blocking operations.
Currently I'm looking into using pipe()+libevent. Is there a faster and more elegant alternative for use with Intel Threading Building Blocks?
...
The following is a testcase I created. Why does every process print the number 1 to 5 and are the numbers not divided over the processes?
code:
#!/usr/bin/python
from subprocess import *
from Queue import Queue
from Queue import Empty
import multiprocessing
from multiprocessing import Process
def main():
r = Runner()
r.run()...
I have the following code which replicates the windows manual and auto reset events.
class event
{
public:
event( bool signalled = false, bool ar = true ) :
_auto( ar ),
_signalled( signalled )
{
pthread_mutex_init( &_mutex, NULL );
pthread_cond_init( &_cond, NULL );
}
~event()
{
...
Here is a simple server application using Bonjour and written in Java. The main part of the code is given here:
public class ServiceAnnouncer implements IServiceAnnouncer, RegisterListener {
private DNSSDRegistration serviceRecord;
private boolean registered;
public boolean isRegistered(){
return registered;
}
...
Hi
In a multithreaded application. I have a bunch of function that loop through a collection to read the information. I also have a bunch of function that modifies that same collection.
I’m looking for a way to isolate all the read and the write together. I don’t want a write to be done while a read is in progress. I was thinking of us...
I have written a very simple game with some simple animations, but I've noticed that when the phone checks email, or several other apps are running, the animations that update in my thread start behaving slowly or choppy.
This is a problem as the game mechanic requires some careful timing of your screen touches based on the animations. ...
I'm experimenting with multithreading in Windows and was wondering whether I should
use Win32 API
use POSIX Threads for Windows
Learning Pthreads would be useful if I tried to develop such applications on different platforms - but am I losing anything by not learning Win32 API? Or are both similar enough so that learning one allows m...
I have an iPhone app with a secondary thread to handle XML parsing. Inside some of those methods, I need to reference dictionaries (for look up, not modification) created and populated in the main thread.
Apple's documentation indicated to me that global variables might be the best way to accomplish this. I'm just now sure what the impl...
I'm trying to understand how parallelism might work using PLINQ, given delayed execution. Here is a simple example.
string[] words = { "believe", "receipt", "relief", "field" };
bool result = words.AsParallel().Any(w => w.Contains("ei"));
With LINQ, I would expect the execution to reach the "receipt" value and return true, without ex...