0
如何在循環內運行一個函數並仍然保持循環運行而不必等待函數2完成時?運行函數並保持循環運行C++
int main(){
function1();
}
function1(){
while(1){
function2(); }
}
function2(){
//some task that needs to do independently while, While loop runs
}
你需要多個線程。 http://en.cppreference.com/w/cpp/thread/thread – 0x5453
http://man7.org/linux/man-pages/man3/popen.3.html – Roelant
所以你想運行'function1()'和'function2()'在同一時間? – Javia1492