[erlang-questions] nif driver c code must be reentrant?

Dan Gudmundsson dangud@REDACTED
Wed May 22 09:31:32 CEST 2013


I believe you are correct, I just grabbed large enough number that will
work in the example even if things are changed.

Even better would be to bump accordingly in the nif with the
enif_consume_timeslice, but then it wouldn't be a short example anymore.

/Dan



On Tue, May 21, 2013 at 8:13 PM, Scott Lystig Fritchie <
fritchie@REDACTED> wrote:

> Dan Gudmundsson <dangud@REDACTED> wrote:
>
> dg> [...]
> dg>         erlang:bump_reductions(1000000)
> dg> [...]
>
> Dan, that prompts a good question that has been bugging several people
> (including me).  Does this 1 million reduction count bump have an effect
> more than a 2000 reduction bump?  IIRC, a process is scheduled out after
> 2000 reductions.  And my (poor) memory says that the reduction count
> starts at 2000, that count is decremented, and a scheduling decision is
> made when the reduction count goes negative.
>
> Does it really make a difference if the count goes negative by a little
> (e.g., only one) or by a lot (e.g., 999,990)?
>
> -Scott
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130522/12a0831a/attachment.htm>


More information about the erlang-questions mailing list