Originally Posted by
Jimbo1986
It doesn't have to be called constantly, it could be called once without a loop.
I see. Probably better not to hammer the memory in that case.
Maybe something like this would work for you:
Code:
#define _POSIX_C_SOURCE 200809L
#include <time.h>
// ...
const struct timespec query_delay = {0, (1000 * 1000) * 10}; // 10ms
const struct timespec extension_period = {1, 0}; // 1s
SetBit(IS_GLOW);
while (intIsLow != 1) {
intIsLow = ReadBits(IS_GLOW);
nanosleep(&query_delay, NULL); // adjust or remove, according to your needs
}
nanosleep(&extension_period, NULL);
UnsetBit(IS_GLOW); // You'll presumably have something like this then