Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Vladimir Barsukov
zGo
Commits
bbdb2ba8
Commit
bbdb2ba8
authored
3 months ago
by
Vladimir Barsukov
Browse files
Options
Download
Email Patches
Plain Diff
add lock/unlock
parent
9a2dfae3
master
v1.6.4
v1.6.3
v1.6.2
v1.6.1
v1.6.0
v1.5.4
v1.5.3
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
zbytes/zbytes.go
+11
-2
zbytes/zbytes.go
with
11 additions
and
2 deletions
+11
-2
zbytes/zbytes.go
+
11
-
2
View file @
bbdb2ba8
...
...
@@ -2,6 +2,7 @@ package zbytes
import
(
"bytes"
"fmt"
"sync"
)
...
...
@@ -41,6 +42,9 @@ func (z *Buffer) WriteString(s string) (n int, err error) {
return
z
.
Buff
.
WriteString
(
s
)
}
func
(
z
*
Buffer
)
WriteAny
(
a
any
)
(
n
int
,
err
error
)
{
return
z
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
a
))
}
func
(
z
*
Buffer
)
Bytes
()
[]
byte
{
z
.
Mu
.
Lock
()
...
...
@@ -48,14 +52,12 @@ func (z *Buffer) Bytes() []byte {
return
z
.
Buff
.
Bytes
()
}
func
(
z
*
Buffer
)
String
()
string
{
z
.
Mu
.
Lock
()
defer
z
.
Mu
.
Unlock
()
return
z
.
Buff
.
String
()
}
func
(
z
*
Buffer
)
Reset
()
{
z
.
Mu
.
Lock
()
defer
z
.
Mu
.
Unlock
()
...
...
@@ -68,3 +70,10 @@ func (z *Buffer) Len() int {
return
z
.
Buff
.
Len
()
}
func
(
z
*
Buffer
)
Lock
()
{
z
.
Mu
.
Lock
()
}
func
(
z
*
Buffer
)
Unlock
()
{
z
.
Mu
.
Unlock
()
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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
Menu
Explore
Projects
Groups
Snippets