Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
bf9fb0da
Commit
bf9fb0da
authored
Mar 02, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
7e1f6104
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
2 deletions
+21
-2
wcfs/client/wcfs.cpp
wcfs/client/wcfs.cpp
+20
-2
wcfs/client/wcfs.h
wcfs/client/wcfs.h
+1
-0
No files found.
wcfs/client/wcfs.cpp
View file @
bf9fb0da
...
...
@@ -627,13 +627,29 @@ pair<FileH, error> _Conn::open(zodb::Oid foid) {
return
make_pair
(
nil
,
E
(
err
));
}
retry:
FileH
f
;
bool
ok
;
tie
(
f
,
ok
)
=
wconn
.
_filehTab
.
get_
(
foid
);
if
(
ok
)
{
f
->
_nopen
++
;
// XXX lock by f.mu ?
bool
closing
;
if
(
f
->
_state
<=
_FileHOpened
)
{
f
->
_nopen
++
;
// XXX lock by f.mu ?
closing
=
false
;
}
else
{
closing
=
true
;
}
wconn
.
_mu
.
Unlock
();
// wait for: "opening" -> opened
// if the file was closing|closed, we should wait for the close to
// complete and retry the open.
if
(
closing
)
{
f
->
_closedq
.
recv
();
goto
retry
;
}
// the file was opening|opened. wait for it to be opened and return the result.
// we can be sure there won't be last Close simultaneous to us as we did ._nopen++
f
->
_openReady
.
recv
();
if
(
f
->
_openErr
!=
nil
)
{
// don't care about f->_nopen-- since f is not returned anywhere
...
...
@@ -649,10 +665,12 @@ pair<FileH, error> _Conn::open(zodb::Oid foid) {
f
->
wconn
=
newref
(
&
wconn
);
f
->
foid
=
foid
;
f
->
_openReady
=
makechan
<
structZ
>
();
f
->
_closedq
=
makechan
<
structZ
>
();
f
->
_openErr
=
nil
;
f
->
_headf
=
nil
;
f
->
blksize
=
0
;
f
->
_headfsize
=
0
;
f
->
_state
=
_FileHOpening
;
f
->
_nopen
=
1
;
f
->
_closed
=
false
;
...
...
wcfs/client/wcfs.h
View file @
bf9fb0da
...
...
@@ -233,6 +233,7 @@ struct _FileH : object {
chan
<
structZ
>
_openReady
;
// in-flight open completed
error
_openErr
;
// error result from open
chan
<
structZ
>
_closedq
;
// in-flight close completed
os
::
File
_headf
;
// file object of head/file
size_t
blksize
;
// block size of this file (does not change after fileh open)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment