Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gostnops
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wei.xuan
gostnops
Commits
65fe60f0
Unverified
Commit
65fe60f0
authored
Nov 06, 2020
by
Xin.Zh
Committed by
GitHub
Nov 06, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #32 from dk-lockdown/dev_1105
optimization:enhance robustness
parents
3cf58709
d02efaca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
task_pool.go
sync/task_pool.go
+12
-1
No files found.
sync/task_pool.go
View file @
65fe60f0
...
...
@@ -21,8 +21,11 @@ import (
"fmt"
"log"
"math/rand"
"os"
"runtime/debug"
"sync"
"sync/atomic"
"time"
)
import
(
...
...
@@ -171,7 +174,15 @@ func (p *TaskPool) run(id int, q chan task) error {
case
t
,
ok
=
<-
q
:
if
ok
{
t
()
func
()
{
defer
func
()
{
if
r
:=
recover
();
r
!=
nil
{
fmt
.
Fprintf
(
os
.
Stderr
,
"%s goroutine panic: %v
\n
%s
\n
"
,
time
.
Now
(),
r
,
string
(
debug
.
Stack
()))
}
}()
t
()
}()
}
}
}
...
...
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