<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 26, 2015 at 9:03 AM, Max Lapshin <span dir="ltr"><<a href="mailto:max.lapshin@gmail.com" target="_blank">max.lapshin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">Is the patch by Steve Vinosky included in this release?</div></div></blockquote><div><br></div><div>s/Vinosky/Vinoski/</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">We still experience big problems with dirty schedulers on 17.4 in our ffmpeg needs.<br></div></div></blockquote><div><br></div><div>My patch for the problem you saw (commit b7c9657) was never applied to 17.x, though it could be if the OTP team wanted to do that. But it is included in 18.0. Are you seeing similar problems with 18.0?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"></div><div class="gmail_extra">By the way, it seems to be very uneasy to enable  runtime switch between dirty and non-dirty schedulers in NIF, because it requires expanding ERL_NIF_INIT macro. Is there any easy way to do it?<br></div></div></blockquote><div><br></div><div>Dirty schedulers don't affect the ERL_NIF_INIT macro, but I think what you're referring to is the ErlNifFunc struct type, which was extended with an extra flags field for dirty schedulers (and perhaps other future uses). But you need not use that flags field to specify dirty scheduling -- you could instead specify in your ErlNifFunc a regular nif that schedules the call over to a dirty scheduler at runtime by checking enif_system_info, like this:</div><div><br></div><div><div>    ErlNifSysInfo si;</div><div>    enif_system_info(&si, sizeof(si));</div><div>    if (si.dirty_scheduler_support)</div></div><div>        enif_schedule_nif(env, "dirty_nif", ERL_NIF_DIRTY_JOB_CPU_BOUND, dirty_nif, argc, argv);</div><div>    else</div><div>        /* run the function as a regular NIF or in your own thread pool */</div><div><br></div><div>This is slower than using the flags field, but the overhead is in the noise for typical applications.</div><div><br></div><div>--steve</div></div></div></div>