Figured out my problem. I was using the CPU clock, and that has ~6ms
granularity when used with the timer, I'm guessing it doesn't fire until
the task is preempted and the CPU time tallied up.

On Tue, Jul 16, 2019 at 13:38 Ben Noordhuis <i...@bnoordhuis.nl> wrote:

> On Tue, Jul 16, 2019 at 2:29 PM Jaka Jančar <j...@kubje.org> wrote:
> >
> > On the motivation: I have user-provided (synchronous, relatively simple)
> snippets of code that run 1k+ times/second on a server and must execute
> very predictably and fast or they can affect the rest of the system/users.
> >
> > I'm using timer_create() with SIGEV_THREAD indeed (so not really
> managing my own thread). Perhaps SIGEV_THREAD_ID would be faster, because
> there is no scheduling/switching between two threads involved, but I was
> under the impression that functions need to be async-signal-safe for that
> as well, just as for SIGEV_SIGNAL. Can you explain why you think that is
> not the case?
>
> With SIGEV_THREAD_ID you can just block the signal with
> pthread_sigmask() and then wait race-free for delivery with
> sigwaitinfo().
>
> Having said that, unless there are other reasons to use timer_create()
> or signals, it's probably easier to suspend with nanosleep() or
> clock_nanosleep().
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "v8-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/v8-users/UcipYq1pJJE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> v8-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/v8-users/CAHQurc_7CwTdkvzTVCmHFP6xRa2%2B3E-xoftcbXCq6hbyz3GKvQ%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/CAMUPXmpKaPGGSh35%3DJVnBcgTdq0GyRhAX7roO5SH4mHA9sK7Jw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to