Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Основная";
Текущий архив: 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
3-30729
roman001
2002-05-19 19:27
2002.06.10
SQL-DMO


3-30721
brat
2002-05-18 21:46
2002.06.10
Как создается SQL база данных


1-30813
Xristos
2002-05-31 10:06
2002.06.10
НАРОД!!! Как это можно сделать???...


4-31054
DMA
2002-04-09 20:00
2002.06.10
Как узнать какое окно сейчас активное?


1-30880
Spartak
2002-05-29 21:38
2002.06.10
Пожайлуста помогите с вопросом.





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский