_do_bgread - Worker functon for the background read thread.

        @param stream <object> - Stream to read until closed
        @param results <BackgroundReadData>

def _do_bgread(stream, blockSizeLimit, pollTime, closeStream, results):
    '''
        _do_bgread - Worker functon for the background read thread.

        @param stream <object> - Stream to read until closed
        @param results <BackgroundReadData>
    '''

    # Put the whole function in a try instead of just the read portion for performance reasons.
    try:
        while True:
            nextData = nonblock_read(stream, limit=blockSizeLimit)
            if nextData is None:
                break
            elif nextData:
                results.addBlock(nextData)

            time.sleep(pollTime)
    except Exception as e:
        results.error = e
        return

    if closeStream and hasattr(stream, 'close'):
        stream.close()

    results.isFinished = True