Форум: "Основная";
Текущий архив: 2002.06.10;
Скачать: [xml.tar.bz2];
Вниз
Как сделать ожидание (аналог sleep()) Найти похожие ветки
← →
Semu (2002-05-30 13:33) [0]Объясните чайнику, как сделать функцию ожидания (аналог sleep()),
что бы прога на время ожидания не грузила систему.
← →
Виктор Щербаков (2002-05-30 13:35) [1]А sleep чем не нравится?
← →
SeMu (2002-05-30 13:38) [2]Будешь смеятся, но в HELPe по Дельфе, такой функции не нашел, я ж говорю, чайник. Где посмотреть то ?
← →
NailS (2002-05-30 13:40) [3]А при sleep она не грузит, правда не реагирует на внешние раздражители.
Как альтернативу можно использовать WaitForMultipleObjects с таймаутом, при этом ждать события например на терминейт для потока.
← →
Виктор Щербаков (2002-05-30 13:43) [4]SeMu (30.05.02 13:38)
Смотри Help|Windows SDK
← →
SeMu (2002-05-30 13:44) [5]Так где найти-то описание Sleep ?
← →
Виктор Щербаков (2002-05-30 13:46) [6]he Sleep function suspends the execution of the current thread for a specified interval.
VOID Sleep(
DWORD dwMilliseconds // sleep time in milliseconds
);
Parameters
dwMilliseconds
Specifies the time, in milliseconds, for which to suspend execution. A value of zero causes the thread to relinquish the remainder of its time slice to any other thread of equal priority that is ready to run. If there are no other threads of equal priority ready to run, the function returns immediately, and the thread continues execution. A value of INFINITE causes an infinite delay.
Return Values
This function does not return a value.
Remarks
A thread can relinquish the remainder of its time slice by calling this function with a sleep time of zero milliseconds.
You have to be careful when using Sleep and DDE. If a thread creates any windows, it must process messages. DDE sends messages to all windows in the system. If you have a thread that uses a wait function with no time-out interval, the system will deadlock. Therefore, if you have a thread that creates windows, use MsgWaitForMultipleObjects or MsgWaitForMultipleObjectsEx, rather than Sleep.
← →
pin (2002-05-30 13:49) [7]Sleep
The Sleep function suspends the execution of the current thread for at least the specified interval.
To enter an alertable wait state, use the SleepEx function.
VOID Sleep(
DWORD dwMilliseconds // sleep time
);
Parameters
dwMilliseconds
[in] Specifies the minimum time interval, in milliseconds, for which execution is to be suspended.
A value of zero causes the thread to relinquish the remainder of its time slice to any other thread of equal priority that is ready to run. If there are no other threads of equal priority ready to run, the function returns immediately, and the thread continues execution.
A value of INFINITE indicates that the suspension should not time out.
← →
pin (2002-05-30 13:51) [8]))
← →
SeMu (2002-05-30 14:01) [9]Спасибо! Тема закрыта.
Страницы: 1 вся ветка
Форум: "Основная";
Текущий архив: 2002.06.10;
Скачать: [xml.tar.bz2];
Память: 0.46 MB
Время: 0.009 c