~jlukas79/+junk/mysql-server

« back to all changes in this revision

Viewing changes to mysys/lf_alloc-pin.c

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
169
169
    if (!(pins= top_ver % LF_PINBOX_MAX_PINS))
170
170
    {
171
171
      /* the stack of free elements is empty */
172
 
      pins= my_atomic_add32(&pinbox->pins_in_array, 1)+1;
 
172
      pins= my_atomic_add32((int32 volatile*) &pinbox->pins_in_array, 1)+1;
173
173
      if (unlikely(pins >= LF_PINBOX_MAX_PINS))
174
174
        return 0;
175
175
      /*
183
183
    }
184
184
    el= (LF_PINS *)_lf_dynarray_value(&pinbox->pinarray, pins);
185
185
    next= el->link;
186
 
  } while (!my_atomic_cas32(&pinbox->pinstack_top_ver, &top_ver,
 
186
  } while (!my_atomic_cas32((int32 volatile*) &pinbox->pinstack_top_ver,
 
187
                            (int32*) &top_ver,
187
188
                            top_ver-pins+next+LF_PINBOX_MAX_PINS));
188
189
  /*
189
190
    set el->link to the index of el in the dynarray (el->link has two usages:
237
238
  do
238
239
  {
239
240
    pins->link= top_ver % LF_PINBOX_MAX_PINS;
240
 
  } while (!my_atomic_cas32(&pinbox->pinstack_top_ver, &top_ver,
 
241
  } while (!my_atomic_cas32((int32 volatile*) &pinbox->pinstack_top_ver,
 
242
                            (int32*) &top_ver,
241
243
                            top_ver-pins->link+nr+LF_PINBOX_MAX_PINS));
242
244
  return;
243
245
}
332
334
  void *list, **addr;
333
335
  struct st_lf_alloc_node *first, *last= NULL;
334
336
  LF_PINBOX *pinbox= pins->pinbox;
 
337
 
335
338
  LINT_INIT(first);
336
 
 
337
339
  npins= pinbox->pins_in_array+1;
338
340
 
339
341
#ifdef HAVE_ALLOCA
403
405
 
404
406
/* lock-free memory allocator for fixed-size objects */
405
407
 
406
 
LF_REQUIRE_PINS(1);
 
408
LF_REQUIRE_PINS(1)
407
409
 
408
410
/*
409
411
  callback for _lf_pinbox_real_free to free a list of unpinned objects -