wait

Shell script not waiting

谁都会走 提交于 2019-12-13 19:55:49
问题 ssh user@myserver.com<<EOF cd ../../my/path/ sh runscript.sh wait cd ../../temp/path sh secondscript.sh EOF The first script runs and asks me the questions in that script, but before i'm even able to start typing to answer them the second script starts running. From what I'm reading this shouldn't be happening even without the wait. 来源: https://stackoverflow.com/questions/22566304/shell-script-not-waiting

Wait in for loops for async function

拜拜、爱过 提交于 2019-12-13 19:09:11
问题 I need run startFunc function synchronously and "wait" in for loop to finish task, to run it again. I can't use await in startFunc(). I need something like .wait() in c# I except result: start 1 end 1 start 2 end 2 etc... function callToDB(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } async function startFunc (i) { console.log('start', i); await callToDB(1000); console.log('end', i); } for (let i = 0; i < 5; i++) { startFunc(i); } 回答1: You need to put the for loop in an

How to wait for all the children to terminate before the parent moves on?

做~自己de王妃 提交于 2019-12-13 16:45:40
问题 I'm doing some parallel programming (multiprocessing) and I need the parent to: 1) Fork several children 2) AFTER all the children have been created, simply WAIT for all of them to terminate 3) After all the children are terminated, do some other work. This is what I tried: int main(int argc, char **argv[]) { int j, i; pid_t children[3]; int pid; // Fork the processes for(j = 0; j < 3; j++){ if((children[j] = fork()) == 0){ // Child process for(i = 0; i < 2; i++){ printf("child %d printing:

java make a method wait for a response of another process

若如初见. 提交于 2019-12-13 12:50:36
问题 In my program, I connect to an interpreter process for another language. I need the program sometimes to ask the interpreter several things and use it's response. The process is stored in a IProcess variable and the communication is done via the IStreamsProxy of the process. to recieve the response, I added an IStreamListener to the IStreamsProxy. However, when I write to the IStreamsProxy (with the write() method), I need the code to wait for the response, e.g. the streamAppend-method of the

Waiting for condition to continue

别说谁变了你拦得住时间么 提交于 2019-12-13 12:49:11
问题 I have a method that I add to a GCD queue that I have created (so it's a serial queue) and then run it async. From within that block of code I make a dispatch to the main queue, when that block of code dispatched to the main queue is complete I set a BOOL flag to YES, so that I further down in my code can check if this condition is YES then I can continue to the next method. Here is the code in short: dispatch_queue_t queue = dispatch_queue_create("ProcessSerialQueue", 0); dispatch_async

Android: Wait() the main thread while a dialog gets input in a separate Thread

我的未来我决定 提交于 2019-12-13 11:32:24
问题 I'm writing an activity in Android where the user modifies an SQL Database. The UI consists of an EditText where the user enters the name, and a Seekbar where the user enters how attractive the person is. Underneath there are a bunch of buttons: add, edit, view, delete. When the user clicks on the "Edit" button, an input dialog is displayed asking the user to input the record number. Once that is done, that record is loaded. The problem I was having was that the inputdialog would be displayed

How can I get my threaded program to print specific output

这一生的挚爱 提交于 2019-12-13 10:12:33
问题 I am having problem dealing with synchronization java threads, applying wait and notify.. I want to figure out how could I implement these in a program where I can print out the answer alternately.. for example person1 will count numbers 1-5 as well as person2, the output should be like this. person1 count 1 person2 count 1 person1 count 2 person2 count 2 person1 count 3 person2 count 3 person1 count 4 person2 count 4 person1 count 5 person2 count 5 Thanks guys. 回答1: You could do this easily

text based adventure help and tips

风格不统一 提交于 2019-12-13 10:04:02
问题 I decided to make a text based adventure and I realized I didn't know much about making one. I do, however, know that I want to make it with a batch file, just because I think it is easier to work with and share. I don't have many questions right now but I'm sure I'll come up with more as time goes on (if I decide this is fun) but right now I have two questions: How do you make lines appear as if someone was typing it? How do you make the line wait x seconds before going to the next process

Run Serial inside Paralell Bash

六眼飞鱼酱① 提交于 2019-12-13 08:44:43
问题 I have added to my explanation a bit. Conceptually, I am running a script that processes in a loop, calling shells that use the line content as an input parameter.(FYI: a kicks off an execution and b monitors that execution) I am needing 1a and 1b to run first, in paralell for the first two $param Next, 2a and 2b need to run in serial for $params when step 1 is complete 3a and 3b will kick off once 2a and 2b are complete (irrelevant if serial or parallel) Loop continues with next 2 lines from

Dispose a frame inside a listener after 3 secs

僤鯓⒐⒋嵵緔 提交于 2019-12-13 08:26:07
问题 I want to dispose the frame 3 seconds after I type a key. Here is my code: frame.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { Timer t = new Timer(3000, null); t.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.out.println("test"); frame.dispose(); } }); t.start(); } } I can see from the console the printed string but the frame is not closing. I've seen a similar thread and use the Timer seemed to be the