Commit 1c652136 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 267c3a34
...@@ -589,7 +589,8 @@ error _Conn::resync(zodb::Tid at) { ...@@ -589,7 +589,8 @@ error _Conn::resync(zodb::Tid at) {
//FileH f = fit.second; //FileH f = fit.second;
// XXX need to lock f.mu because wconn.atMu is only R now. // XXX need to lock f.mu because wconn.atMu is only R now.
// XXX need to coordinate with e.g. FileH.close // XXX need to coordinate with e.g. FileH.close -> "if f.state != CLOSING" ?
// XXX need to coordinate with e.g. Conn.open -> "if f.state != OPENING" ?
string ack; string ack;
// XXX f._watchMu.lock() + unlock() // XXX f._watchMu.lock() + unlock()
// XXX + recheck status before sending the watch? // XXX + recheck status before sending the watch?
...@@ -632,6 +633,7 @@ pair<FileH, error> _Conn::open(zodb::Oid foid) { ...@@ -632,6 +633,7 @@ pair<FileH, error> _Conn::open(zodb::Oid foid) {
f->_nopen++; // XXX lock by f.mu ? f->_nopen++; // XXX lock by f.mu ?
wconn._mu.Unlock(); wconn._mu.Unlock();
// wait for: "opening" -> opened
f->_openReady.recv(); f->_openReady.recv();
if (f->_openErr != nil) { if (f->_openErr != nil) {
// don't care about f->_nopen-- since f is not returned anywhere // don't care about f->_nopen-- since f is not returned anywhere
...@@ -805,6 +807,8 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma) ...@@ -805,6 +807,8 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma)
xerr::Contextf E("%s: mmap f<%s> [blk%ld +blk%ld)", v(f.wconn), v(f.foid), blk_start, blk_len); xerr::Contextf E("%s: mmap f<%s> [blk%ld +blk%ld)", v(f.wconn), v(f.foid), blk_start, blk_len);
// XXX closed -> return E(os::ErrClosed)
error err; error err;
if (blk_start < 0) if (blk_start < 0)
......
...@@ -37,6 +37,9 @@ using namespace golang; ...@@ -37,6 +37,9 @@ using namespace golang;
// os:: // os::
namespace os { namespace os {
global<error> ErrClosed = errors::New("file already closed");
// XXX -> make public // XXX -> make public
static error _pathError(const char *op, const string &path, int syserr); static error _pathError(const char *op, const string &path, int syserr);
......
...@@ -58,6 +58,9 @@ using std::vector; ...@@ -58,6 +58,9 @@ using std::vector;
// os:: // os::
namespace os { namespace os {
extern global<error> ErrClosed;
// os::File mimics os.File from Go. // os::File mimics os.File from Go.
// its operations return error with full file context. // its operations return error with full file context.
typedef refptr<class _File> File; typedef refptr<class _File> File;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment