wait

How to force a program to wait until an HTTP request is finished in JavaScript?

Hello, Is there a way in JavaScript to send an HTTP request to an HTTP server and wait until the server responds with a reply? I want my program to wait until the server replies and not to execute any other command that is after this request. If the HTTP server is down I want the HTTP request to be repeated after a timeout until the ser...

Waiting Period Before iPhone APNs Starts Pushing ?

I am running Push Notification on two test apps. The first test app I got working over a 2 day period. The 2nd test app I tried to implement Push Notification tonight and have been banging my head over it. I am able to swap the certificates and the 1st app receives notifications, but when I use the .pem for the 2nd app, nothing happens. ...

Why the output is printing twice?

May be it look childish for most of you but I am unable to understand this small piece of code. #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> int main(int argc, char** argv) { int i, pid; pid = fork(); printf("Forking the pid: %d\n",pid); for(i =0; i<5; i++) ...

Query related to threads in Qt

Hi, i want my application to wait indefinitely till a task gets completed in another thread. How to perform this in Qt. in windows we use waitforsingletonobject but is there any alternative to this. can i get some hints from you guys.. Thanks ...

is there any difference if thread is waiting for monitor to be freed before synchronized block or if it calls wait()

I've read many docs about thread states, some of them tells that there is two different states: blocked (before synchronized) and wait (if calls wait), some others are telling that there is only one state: wait. Moreover, some docs telling that you should call notify() for every wait() and if you don't then threads waiting() will never b...

wait command wont wait for child process to finish c cpp c++

I am trying to write a c++ program that creates a child process, runs a command and pipes the output back to the input of a command the parent is running. I have the parent execute the wait(NULL) or wait((void*)pid) command but it does not wait. here is the code: #include <string.h> #include <fstream> #include <iostream> #include <uni...

Boost condition deadlock using wait() in producer-consumer code

I have implemented a basic threaded producer-consumer (thread 1 = producer, thread 2 = consumer) using Boost threads and conditions. I am getting stuck in wait() indefinitely quite often. I can't really see what could be wrong here. Below is some pseudo-code: // main class class Main { public: void AddToQueue(...someData...) { b...

How to wait for all tasks in an ThreadPoolExecutor to finish without shutting down the Executor?

I can't use shutdown() and awaitTermination() because it is possible new tasks will be added to the ThreadPoolExecutor while it is waiting. So I'm looking for a way to wait until the ThreadPoolExecutor has emptied it's queue and finished all of it's tasks without stopping new tasks from being added before that point. If it makes any di...

jquery : wait until all ajax calls finish then continue

I have some ajax calls in my document.ready() like : for (j=1; j <= 7; j++){ (function(index) { $.getJSON('my.php', {id:index}, function(data) { $.each(data, function(index2, array){ ........ }); }); })(j) } //DO NOT CONTINUE UNTIL FINISH AJAX CALLS ........ MORE JQUERY CODE ...

Java Thread Wait-Notify

I have 3 threads (A, B, C) that i just can't make them work how i want them to. ALL these 3 threads share a reference to the same object - K. What i'm trying to do, is to start all 3 up, then at some point in time when thread A arrives in a certain state, pause threads B and C, until A executes some method work() and when work finishes, ...