[riot-devel] vtimer_usleep_until or similar

Martine Lenders authmillenon at gmail.com
Tue Oct 21 16:09:12 CEST 2014


Hi again,

2014-10-21 16:08 GMT+02:00 Martine Lenders <authmillenon at gmail.com>:

>
> static char RUN_STACK[KERNEL_CONF_STACKSIZE_DEFAULT];
>
> void *run(void *run_args)
> {
>     (void)run_args;
>
>     while (1) {
>         function_call(args);
>
>         thread_sleep();
>     }
>
>     return NULL;
> }
>
> int main(void)
> {
>     vtimer_t timer;
>     timex_t inc = timex_set(0, utime_increment);
>     kernel_pid_t pid = thread_create(RUN_STACK,
>                                      KERNEL_CONF_STACKTEST_DEFAULT,
>                                      PRIORITY_MAIN - 1,
>                                      CREATE_SLEEPING | CREATE_STACKTEST,
>                                      run, NULL, "runner");
>
>     while (1) {
>         vtimer_set_wakeup(&timer, inc, pid);
>         vtimer_sleep(inc);
>     }
> }
>
(This code was neither compiled nor tested, so beware ;))

Cheers,
Martine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/devel/attachments/20141021/5fa8e1ab/attachment-0001.html>


More information about the devel mailing list