Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Levin Zimmermann
go-fuse
Commits
ae405425
Commit
ae405425
authored
Jul 18, 2017
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
splice: use Go style naming for pairPool.
parent
6aa09dea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
29 deletions
+29
-29
splice/pool.go
splice/pool.go
+29
-29
No files found.
splice/pool.go
View file @
ae405425
...
@@ -47,46 +47,46 @@ func newSplicePairPool() *pairPool {
...
@@ -47,46 +47,46 @@ func newSplicePairPool() *pairPool {
return
&
pairPool
{}
return
&
pairPool
{}
}
}
func
(
me
*
pairPool
)
clear
()
{
func
(
pp
*
pairPool
)
clear
()
{
me
.
Lock
()
pp
.
Lock
()
for
_
,
p
:=
range
me
.
unused
{
for
_
,
p
:=
range
pp
.
unused
{
p
.
Close
()
p
.
Close
()
}
}
me
.
unused
=
me
.
unused
[
:
0
]
pp
.
unused
=
pp
.
unused
[
:
0
]
me
.
Unlock
()
pp
.
Unlock
()
}
}
func
(
me
*
pairPool
)
used
()
(
n
int
)
{
func
(
pp
*
pairPool
)
used
()
(
n
int
)
{
me
.
Lock
()
pp
.
Lock
()
n
=
me
.
usedCount
n
=
pp
.
usedCount
me
.
Unlock
()
pp
.
Unlock
()
return
n
return
n
}
}
func
(
me
*
pairPool
)
total
()
int
{
func
(
pp
*
pairPool
)
total
()
int
{
me
.
Lock
()
pp
.
Lock
()
n
:=
me
.
usedCount
+
len
(
me
.
unused
)
n
:=
pp
.
usedCount
+
len
(
pp
.
unused
)
me
.
Unlock
()
pp
.
Unlock
()
return
n
return
n
}
}
func
(
me
*
pairPool
)
drop
(
p
*
Pair
)
{
func
(
pp
*
pairPool
)
drop
(
p
*
Pair
)
{
p
.
Close
()
p
.
Close
()
me
.
Lock
()
pp
.
Lock
()
me
.
usedCount
--
pp
.
usedCount
--
me
.
Unlock
()
pp
.
Unlock
()
}
}
func
(
me
*
pairPool
)
get
()
(
p
*
Pair
,
err
error
)
{
func
(
pp
*
pairPool
)
get
()
(
p
*
Pair
,
err
error
)
{
me
.
Lock
()
pp
.
Lock
()
defer
me
.
Unlock
()
defer
pp
.
Unlock
()
me
.
usedCount
++
pp
.
usedCount
++
l
:=
len
(
me
.
unused
)
l
:=
len
(
pp
.
unused
)
if
l
>
0
{
if
l
>
0
{
p
:=
me
.
unused
[
l
-
1
]
p
:=
pp
.
unused
[
l
-
1
]
me
.
unused
=
me
.
unused
[
:
l
-
1
]
pp
.
unused
=
pp
.
unused
[
:
l
-
1
]
return
p
,
nil
return
p
,
nil
}
}
...
@@ -110,13 +110,13 @@ func discardAll(fd int) {
...
@@ -110,13 +110,13 @@ func discardAll(fd int) {
}
}
}
}
func
(
me
*
pairPool
)
done
(
p
*
Pair
)
{
func
(
pp
*
pairPool
)
done
(
p
*
Pair
)
{
discardAll
(
p
.
r
)
discardAll
(
p
.
r
)
me
.
Lock
()
pp
.
Lock
()
me
.
usedCount
--
pp
.
usedCount
--
me
.
unused
=
append
(
me
.
unused
,
p
)
pp
.
unused
=
append
(
pp
.
unused
,
p
)
me
.
Unlock
()
pp
.
Unlock
()
}
}
func
init
()
{
func
init
()
{
...
...
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