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

POSIX equivalent of rtems_timer_fire_after



Richard M. Barry wrote:
> I'm rewriting some code that uses a Classic API timer to trigger the excecution of a procedure after a certain amount of time has elapsed, by calling rtems_timer_fire_after(... , rtems_timer_service_routine ,...)
> 
> I want to rewrite the code to only use the POSIX API, so I have to implement an equivalent mechanism.   My question is, is the best way to do this:
> 
> 1.Start a POSIX thread (containg the code previously in the rtems_timer_service_routine) that waits for a signal using sigsuspend(), and then 
> 2.start a timer that fires the needed signal in my main thread?   
> 
> Just making sure I understand the use of sigsuspend() correctly.

Without building a timer server that executes an arbitrary user provided
function, I think that is the only mechanism POSIX provides.

This is one area I think POSIX was weak in.

> Thanks,
> Richard
>