max=(p1)
public
Sets the maximum size of the queue to
the given number.
Show source
static VALUE
rb_szqueue_max_set(VALUE self, VALUE vmax)
{
long max = NUM2LONG(vmax);
long diff = 0;
struct rb_szqueue *sq = szqueue_ptr(self);
if (max <= 0) {
rb_raise(rb_eArgError, "queue size must be positive");
}
if (max > sq->max) {
diff = max - sq->max;
}
sq->max = max;
while (diff-- > 0 && wakeup_one(szqueue_pushq(sq))) {
/* keep waking more up */
}
return vmax;
}