Re: Delay or Sleep



>Hi,
>I want to implement a delay or a certain number of ms.  Under Windows, I  
>would use Sleep().  Is there an equivalent GTKmm/glib Way(TM)?

first, let me point out that gtkmm/glib are not equivalents to the
win32 API. gtkmm is a thin wrapper around a GUI toolkit (gtk), and gtk
does not concern itself with issues other than being a GUI
toolkit. glib is a portability and convenience library, that
encapsulates many common programming tasks done in C so that the
resulting code is either more portable between operating systems or
neater, or both.

on any POSIX system, sleep(2), usleep (2) and nanonsleep (2) are the
primary system calls for putting a thread/task to sleep for a
specified time period. however, the resolution of these functions is
entirely dependendent on the internal implementation of the operating
system and may differ from the publicized resolution that the
functions claim. it can also be affected by priviledges owned by the
thread. for example, on older versions of Linux, it was impossible to
sleep for less than 10ms, unless you were a realtime thread and then
waits of 2ms or less would busy wait in the kernel. Ick.

it is very unusual to need to do this in a GUI program, so why don't
you explain a little bit more about what you are trying to do.

--p



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]