Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-datastore
Commits
0f07328c
Commit
0f07328c
authored
Dec 26, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix locking in syncbatch
parent
19e39c85
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
sync/sync.go
sync/sync.go
+7
-7
No files found.
sync/sync.go
View file @
0f07328c
...
...
@@ -92,24 +92,24 @@ func (d *MutexDatastore) Close() error {
}
type
syncBatch
struct
{
lk
sync
.
Mutex
batch
ds
.
Batch
mds
*
MutexDatastore
}
func
(
b
*
syncBatch
)
Put
(
key
ds
.
Key
,
val
interface
{})
error
{
b
.
lk
.
Lock
()
defer
b
.
lk
.
Unlock
()
b
.
mds
.
Lock
()
defer
b
.
mds
.
Unlock
()
return
b
.
batch
.
Put
(
key
,
val
)
}
func
(
b
*
syncBatch
)
Delete
(
key
ds
.
Key
)
error
{
b
.
lk
.
Lock
()
defer
b
.
lk
.
Unlock
()
b
.
mds
.
Lock
()
defer
b
.
mds
.
Unlock
()
return
b
.
batch
.
Delete
(
key
)
}
func
(
b
*
syncBatch
)
Commit
()
error
{
b
.
lk
.
Lock
()
defer
b
.
lk
.
Unlock
()
b
.
mds
.
Lock
()
defer
b
.
mds
.
Unlock
()
return
b
.
batch
.
Commit
()
}
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