> Wouldn't it be a waste of resource of you were to create same number of
> Threads as the Timers required.

        Yes, it would.

> Instead if we had a functionality
> within pth
> available that would be the best approach or use the underlying Target OS
> Timer functionality to get the same functionality. Has there
> anyone used the
> Target OS timer functionality with pth??

        Just create one thread to handle all the timers. It computes the time until
the next timer fires and does a pthread_cond_timedwait for that amount of
time. Just make sure to signal the condition variable if you add a new timer
that expires before all existing timers. I recommend storing the timers as a
linked list in firing order.

        DS


______________________________________________________________________
GNU Portable Threads (Pth)            http://www.gnu.org/software/pth/
Development Site                      http://www.ossp.org/pkg/lib/pth/
Distribution Files                          ftp://ftp.gnu.org/gnu/pth/
Distribution Snapshots                 ftp://ftp.ossp.org/pkg/lib/pth/
User Support Mailing List                            [EMAIL PROTECTED]
Automated List Manager (Majordomo)           [EMAIL PROTECTED]

Reply via email to