Quellcode durchsuchen

use consume_timeslice as intended

pull/71/head
lwalkin vor 10 Jahren
Ursprung
Commit
a9570b0a5d
1 geänderte Dateien mit 8 neuen und 2 gelöschten Zeilen
  1. +8
    -2
      c_src/decoder.c

+ 8
- 2
c_src/decoder.c Datei anzeigen

@ -754,8 +754,14 @@ decode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
start = d->i;
while(d->i < bin.size) {
//fprintf(stderr, "state: %d\r\n", dec_curr(d));
if(should_yield(d->i - start, d->bytes_per_iter)) {
consume_timeslice(env, d->i - start, d->bytes_per_iter);
if(should_yield(d->i - start, d->bytes_per_iter)
/* A system could handle roughly 100kb per millisecond on a single core.
* So the total amount of work per millisecond is 100kb.
* We report the percentage of the time every (bytes_per_iter) bytes
* in hope that the system will ask as to yield. We don't yield until
* asked by the system according to our feedback (of questionable accuracy).
*/
&& consume_timeslice(env, d->i - start, 100000)) {
return enif_make_tuple5(
env,
st->atom_iter,

Laden…
Abbrechen
Speichern