pike.git / src / modules / _Stdio / buffer.cmod

version» Context lines:

pike.git/src/modules/_Stdio/buffer.cmod:934:    if ((write_fun_num = find_identifier("write", f->prog)) == -1) {    Pike_error("Cannot call unknown function \"write\".\n");    }       inh = INHERIT_FROM_INT(f->prog, write_fun_num);       if( inh->prog == file_program )    {    fd = get_inherit_storage( f, inh - f->prog->inherits );    -  /* lock this object. */ +  /* FIXME: lock this object and the fd. */ +  THREADS_ALLOW();    while( sz > written && nbytes )    {    ptrdiff_t rd = MINIMUM(MINIMUM(sz-written,4096),nbytes);    unsigned char *ptr = io_read_pointer( io );    ptrdiff_t res;    res = fd_write( fd->box.fd, ptr, rd );    if( res == -1 && errno == EINTR )    continue;    if( res <= 0 ) {    fd->my_errno = errno;    if (!written) written = -1;    break;    }    io_consume( io, res );    written += res;    nbytes-=res;    } -  +  THREADS_DISALLOW(); +     io_set_events( io, fd, PIKE_BIT_FD_WRITE_OOB, PIKE_FD_WRITE);    }    else    {    /* some other object. Just call write */    while( sz > written && nbytes)    {    size_t rd = MINIMUM(MINIMUM(sz-written,4096),nbytes);    ptrdiff_t wr = io_call_write( io, f, rd );    if( wr <= 0 )