Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
4679e521
Commit
4679e521
authored
Dec 23, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
0853555b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
+16
-9
go/internal/xtracing/tracetest/tracetest.go
go/internal/xtracing/tracetest/tracetest.go
+16
-9
No files found.
go/internal/xtracing/tracetest/tracetest.go
View file @
4679e521
...
...
@@ -152,6 +152,7 @@ type Msg struct {
type
_chan
struct
{
t
*
T
msgq
chan
*
Msg
down
chan
struct
{}
// becomes ready when closed
_name
string
}
...
...
@@ -166,16 +167,21 @@ func (ch *_chan) Send(event interface{}) {
fmt
.
Printf
(
"%s <- %T %v
\n
"
,
ch
.
name
(),
event
,
event
)
}
ack
:=
make
(
chan
error
)
ch
.
msgq
<-
&
Msg
{
event
,
ack
}
err
:=
<-
ack
if
err
!=
nil
{
ch
.
t
.
fatalfInNonMain
(
"%s: send: %s"
,
ch
.
name
(),
err
)
select
{
case
<-
ch
.
down
:
ch
.
t
.
fatalfInNonMain
(
"%s: send: channel was closed"
,
ch
.
name
())
case
ch
.
msgq
<-
&
Msg
{
event
,
ack
}
:
err
:=
<-
ack
if
err
!=
nil
{
ch
.
t
.
fatalfInNonMain
(
"%s: send: %s"
,
ch
.
name
(),
err
)
}
}
}
// Close implements ChanTx.
func
(
ch
*
_chan
)
Close
()
{
close
(
ch
.
msgq
)
close
(
ch
.
down
)
// note - not .msgq
}
// Recv implements ChanRx.
...
...
@@ -732,9 +738,6 @@ func (t *T) FailNow() {
default
:
}
// in any case close channel where future Sends may arrive so that will panic too.
ch
.
Close
()
}
// order channels by name
...
...
@@ -752,13 +755,17 @@ func (t *T) FailNow() {
}
}
// log the deadlock details and nak
all senders
.
// log the deadlock details and nak
senders that we received from
.
// nak them only after deadlock printout, so that the deadlock text
// comes first, and their "panics" don't get intermixed with it.
t
.
Log
(
bad
)
for
_
,
__
:=
range
sendv
{
__
.
msg
.
nak
(
"XXX deadlock"
)
// XXX reason can be custom / different
}
// in any case close channel where future Sends may arrive so that will "panic" too.
for
_
,
ch
:=
range
streamTab
{
ch
.
Close
()
}
t
.
TB
.
FailNow
()
}
...
...
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