Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
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
cc350d55
Commit
cc350d55
authored
Nov 19, 2020
by
watermelon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opt: opt comments for taskpool
parent
e7888cff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
options.go
sync/options.go
+2
-2
task_pool.go
sync/task_pool.go
+5
-0
No files found.
sync/options.go
View file @
cc350d55
...
...
@@ -13,7 +13,7 @@ const (
// Task Pool Options
/////////////////////////////////////////
// TaskPoolOption is optional settings for task pool
// TaskPoolOption
s
is optional settings for task pool
type
TaskPoolOptions
struct
{
tQLen
int
// task queue length. buffer size per queue
tQNumber
int
// task queue number. number of queue
...
...
@@ -40,7 +40,7 @@ func (o *TaskPoolOptions) validate() {
type
TaskPoolOption
func
(
*
TaskPoolOptions
)
// WithTaskPoolTask
QueueLength
set @size of the task queue pool size
// WithTaskPoolTask
PoolSize
set @size of the task queue pool size
func
WithTaskPoolTaskPoolSize
(
size
int
)
TaskPoolOption
{
return
func
(
o
*
TaskPoolOptions
)
{
o
.
tQPoolSize
=
size
...
...
sync/task_pool.go
View file @
cc350d55
...
...
@@ -43,7 +43,10 @@ type GenericTaskPool interface {
AddTaskAlways
(
t
task
)
// AddTaskBalance add task to idle queue
AddTaskBalance
(
t
task
)
// Close use to close the task pool
Close
()
// IsClosed use to check pool status.
IsClosed
()
bool
}
func
goSafely
(
fn
func
())
{
...
...
@@ -278,4 +281,6 @@ func (p *taskPoolSimple) worker(t task) {
func
(
p
*
taskPoolSimple
)
Close
()
{}
func
(
p
*
taskPoolSimple
)
IsClosed
()
bool
{
return
false
}
func
(
p
*
taskPoolSimple
)
AddTaskBalance
(
t
task
)
{
p
.
AddTaskAlways
(
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