Java Wait() auch in C++
-
Hallo!
In Java gibt es diese möglichkeit, um zu warten. ich verwende das oft bei threads in while-loops, so dass die cpu-auslastung nicht auf 100% hochschießt.
synchronized(this){ try{ ((java.lang.Object)this).wait(1); } catch (InterruptedException exc){ //do nothing } }Gibt es eine ähnliche Funktionalität auch in C++?
Grüße,
-
In Standard-C++ nicht, aber je nach Betriebssystem gibt es Sleep(millisekunden) (Windows) oder sleep(sekunden) (UNIX).
-
danke.