I wrote this code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/types.h>
#include <sys/shm.h>
#define N 512
void chunk0(unsigned int *s, unsigned int *a, unsigned int *b, int MID,int it);
void chunk1(unsigned int *s, unsigned int *a, unsigned int *b, int MID,int it);
void chunk2(unsigned int *s, unsig...
I'm trying to write a program with 2 classes, a controller and a class that does a lot of computation. The controller creates a couple instances of the other class, then tells them all to start their calculations (in parallel). They each return when they are finished, and the controller resumes, and then, some time later, the controller ...
Hi there,
I have a problem with creating parallel program using multiprocessing. AFAIK when I start a new process using this module (multiprocessing) I should do "os.wait()" or "childProcess.join()" to get its' exit status. But placing above functions in my program can occur in stopping main process if something happens to child process...
Hello
My code has a function (F1) to return YES/NO based on information read from server. So it uses async nsurlconnection to receive data.
So F1 starts connection and MUST wait for data to be loaded
The question is how can i implement it?
thanks
...
Hi guys I just want the program to display the layout main0 and stay for a few secounds then display layout main1 like the programs we see in any phone where an image or layout show up at the start of the program and then fade.
/**the main activity */
public class rdwt extends Activity implements OnClickListener{
Button b1;
Button b2;...
Specifically, can somebody tell me what is wrong with this piece of code. It should start the threads, so should print "Entering thread.." 5 times and then wait until notifyAll() is called. But, it randomly prints "Entering.." and "Done.." and still keeps waiting on others.
public class ThreadTest implements Runnable {
private int n...
Having this wait declaration:
public final native void wait(long timeout) throws InterruptedException;
It could exit by InterruptedException, or by timeout, or because Notify/NotifyAll method was called in another thread, Exception is easy to catch but...
There is any way to know if the exits cause was timeout or notify?
EDIT:
This...
I have a simple function1 that does a http request to a google api and returns the $result.
I then have another function2 that, if $result isset, should use $result to do some computing and then return $finalresult. .
My problem is that the call to the google api takes a couple of seconds and by the time $result is returned by function1...
I'm using the readline() function to read data from a file object obtained through the subprocess module: proc = subprocess.Popen(cmd, bufsize=0, stdout=subprocess.PIPE). This allows me to use proc.stdout as a file-like object with proc.stdout.readline(). My issue is that this pauses waiting for input and I'd like it to time out and m...
I'm running a recorded load test in JMeter. It appears that when the test is replayed, JMeter doesn't wait for the request to respond before proceeding onto the next request in sequence.
How do I address this?
...
I would like to know if its possible to "WinWaitActive" for "WindowWithThisTitle" and "WindowWithThatTitle" at the same time. I'm executing a command and there could be a window telling me that the connection failed or a user/pass dialog coming up.
Is there another way doing it as this?
WinWaitActive("Title1", "", 5)
If(WinExists("Titl...
I have a main game thread but when the target score is achieved I have an activity that is launched called StageCleared which basically displays the stats to the user of their performance and then they can press a continue button to carry on with the game. This should switch focus back to the running thread that should continue execution...
am basically looking for a way in jquery where my script will wait 15seconds or so, and display a correct ans if the user hasnt selected an answer already. at the moment it just seems to run straight through. ps this method is called in a for loop, with other methods/functions so it runs straight through iterating through the array. thr ...
Hi,
If the main thread quits before child finishes its work, and child tries to notify, what will happen?
Thanks
...
Hello!
In objective c how would you get a function to pause until another one returns?
Thanks!
Christian Stewart
...
Hi,
I am trying to get familiar with Java threads for the SCJP and I had a question.
In the below-written code i simply created:
two Runnables with
a common data storage (an array) and
a synchronized write() method to fill it with data successively leaving a letter as a mark for each Runnable (A and B) in sequence.
I know the code...
I want to force a JavaScript program to wait in some particular points of its execution until a variable has changed. Is there a way to do it? I have already found an extension that is called "narrative JavaScript" that force the program to wait until an event to happen. Is there a way to create a new event, a "variable change event" for...
I have a Windows Phone 7 application (Silverlight-based) that sends a web request and receives a web response. It works fine - I am using BeginGetReponse and an AsyncCallback to call EndGetResponse.
However, I need to wait for the response to be fully received, so that I can fill a collection with the data from the response.
What woul...
Hi,
I have the following "consumer" code:
....
while 1:
time.sleep(self.sleeptime)
cond.acquire() #acquire the lock
print currentThread(), "lock acquired"
while itemq.isEmpty():
cond.wait()
itemq.consume()
print currentThread(),"Consumed One Item"
cond.rel...
Hello,
I'm playing around with QT and I want to create a simple pause between two commands. However it won't seem to let me use Sleep(int mili); and I can't find any obvious wait functions.
I am basically just making a console app to test some class code which will later be included in a proper QT GUI, so for now I'm not bothered about...