"William E. Kempf" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

> > Speaking about the timer I ment something like that:
> >
> > typedef int milliseconds;
> >
> > class stopwatch
> > {
> > public:
> >     stopwatch()
> >         : started_(::GetTickCount())
> >     {}
> >
> >     milliseconds elapsed() const
> >     {
> >         return ::GetTickCount() - started_;
> >     }
> >
> > private:
> >     const DWORD started_;
> > };
>
> Ahh... that's not a threading concept ;).

Let me disagree here :) A couple of days ago I was implementing a user mode
task scheduler. And I had the scheduler thread updating the tasks delays 4
times per second and putting ready for execution tasks in the execution
queue. I tryed to make it portable but the problem was that I could be sure
that the scheduler thread would receive its time slice exactly every 250 ms.
To solve the problem I decided to increase the scheduler thread priority and
to measure the time the thread spent sleeping till the next time slice. I
was using boost::thread library and my solution could be implemented by
means of the library and made my code unportable. That was the rationale of
my posting.



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to