Return the fiber into the pool
492410
def checkin(result=nil)
      @reserved.delete ::Fiber.current.object_id
      @pool.unshift ::Fiber.current
      ::Fiber.yield
    end
808599
function(fiberId) {
    var ret = undefined
    try {
      ret = f()
      if (next) {
        return next(ret)
      } else {
        // drop it
      }
    } catch (e) {
      (logger || debug)(e.stack)
      if (error) {
        // if there's an error callback then throw it that way
        return error(e)
      } else {
        throw e
      }
    } finally {
      // clean up
      var fiber_ = _spawnBookkeeping._fibers[fiberId]
      if (typeof fiber_ === 'undefined') {
        throw new Error('Failed to find current fiber in spawn.fibers')
      }
      // remove our handle on this fiber so that it will get garbage collected
      delete _spawnBookkeeping._fibers[fiberId]
      --_spawnBookkeeping._fibers._length
    }
  }
1045657
public PooledWsByteBufferImpl getEntry() {
        PooledWsByteBufferImpl returnValue = pool.get();
        if (returnValue == null) {
            returnValue = create();
        }
        if (inUseTable != null) {
            inUseTable.put(returnValue, returnValue);
        }
        return returnValue;
    }
860478
public static void returnByteArray(final byte[] b)
    {
        if (b==null)
            return;
        
        byte[][] pool = (byte[][])__pools.get();
        for (int i=pool.length;i-->0;)
        {
            if (pool[i]==null)
            {
                pool[i]=b;
                return;
            }
        }

        // slot.
        int s = __slot++;
        if (s<0)s=-s;
        pool[s%pool.length]=b;
    }
102925
def read(self, size=-1):
        """"""
        if size == 0:
            return b''
        elif size < 0:
            from_buf = self._read_from_buffer()
            self._current_pos = self._content_length
            return from_buf + self._raw_reader.read()

        #
        # Return unused data first
        #
        if len(self._buffer) >= size:
            return self._read_from_buffer(size)

        #
        # If the stream is finished, return what we have.
        #
        if self._eof:
            return self._read_from_buffer()

        #
        # Fill our buffer to the required size.
        #
        # logger.debug('filling %r byte-long buffer up to %r bytes', len(self._buffer), size)
        self._fill_buffer(size)
        return self._read_from_buffer(size)
297616
def Pool(pool='AnyPool', **kwargs):
    '''
    

    '''

    if pool == 'MPIPool':
        return MPIPool(**kwargs)
    elif pool == 'MultiPool':
        return MultiPool(**kwargs)
    elif pool == 'SerialPool':
        return SerialPool(**kwargs)
    elif pool == 'AnyPool':
        if MPIPool.enabled():
            return MPIPool(**kwargs)
        elif MultiPool.enabled():
            return MultiPool(**kwargs)
        else:
            return SerialPool(**kwargs)
    else:
        raise ValueError('Invalid pool ``%s``.' % pool)
369213
def get_chunk(self):
        """"""
        while not self._eof_reached:
            read = self.input_stream.read(self.chunk_size - len(self._partial_chunk))
            if len(read) == 0:
                self._eof_reached = True
            self._partial_chunk += read
            if len(self._partial_chunk) == self.chunk_size or self._eof_reached:
                chunk = self._partial_chunk
                self._partial_chunk = ""
                return chunk
1254646
def returner(ret):
    '''
    
    '''
    try:
        with _get_serv(ret, commit=True) as cur:
            sql = '''INSERT INTO salt_returns
                    (fun, jid, return, id, success, full_ret, alter_time)
                    VALUES (%s, %s, %s, %s, %s, %s, to_timestamp(%s))'''

            cur.execute(sql, (ret['fun'], ret['jid'],
                              psycopg2.extras.Json(ret['return']),
                              ret['id'],
                              ret.get('success', False),
                              psycopg2.extras.Json(ret),
                              time.time()))
    except salt.exceptions.SaltMasterError:
        log.critical('Could not store return with pgjsonb returner. PostgreSQL server unavailable.')
736091
private void returnLed(Buffer buffer) {
        Callback<LedColor> callback = getFirstCallback(BeanMessageID.CC_LED_READ_ALL);
        if (callback != null) {
            callback.onResult(LedColor.fromPayload(buffer));
        }
    }
1250572
def FromStream(cls, stream, auto_transfer=True, total_size=None, **kwds):
        """"""
        return cls(stream, auto_transfer=auto_transfer, total_size=total_size,
                   **kwds)
881330
public void returnToHashtableEntryPool(HashtableEntry htEntry) {
        if (htEntry != null) {
            htEntry.reset();
            htEntryPool.add(htEntry);
            //htEntryPool.retCount++;
        }
    }
880634
def pool(self):
        """"""
        self._pool = self._pool or gevent.pool.Pool(size=self.pool_size)
        return self._pool
871134
async def connect(self):
        '''
        '''
        assert not self.closed
        connection = await self._get()
        return PoolConnection(self, connection)
1155628
def pool(self):
        """"""
        self._pool = self._pool or eventlet.GreenPool(size=self.pool_size)
        return self._pool
205321
function FiberFuture(fn, context, args) {
	this.fn = fn;
	this.context = context;
	this.args = args;
	this.started = false;
	var that = this;
	process.nextTick(function() {
		if (!that.started) {
			that.started = true;
			Fiber(function() {
				try {
					that.return(fn.apply(context, args));
				} catch(e) {
					that.throw(e);
				}
			}).run();
		}
	});
}
474507
def stream(self, chunk_size=64*1024):
        ''
        #return self.jfs.stream(url='%s?mode=bin' % self.path, chunk_size=chunk_size)
        return self.jfs.stream(url=self.path, params={'mode':'bin'}, chunk_size=chunk_size)
787224
@SuppressWarnings("unchecked")
  private E borrowInternal() {

    if (this.size > 0) {
      E element = (E) this.pool[this.size];
      this.pool[this.size--] = null;
      return element;
    } else {
      return create();
    }
  }