mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-04-19 19:28:22 +00:00
implement task queue waiting for resources
This commit is contained in:
19
task/task.go
19
task/task.go
@@ -1,6 +1,7 @@
|
||||
package task
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
@@ -49,17 +50,21 @@ type Task struct {
|
||||
Name string
|
||||
ID int
|
||||
State State
|
||||
resources []string
|
||||
wgTask *sync.WaitGroup
|
||||
}
|
||||
|
||||
// NewTask creates new task
|
||||
func NewTask(process Process, name string, ID int) *Task {
|
||||
func NewTask(process Process, name string, ID int, resources []string, wgTask *sync.WaitGroup) *Task {
|
||||
task := &Task{
|
||||
output: NewOutput(),
|
||||
detail: &Detail{},
|
||||
process: process,
|
||||
Name: name,
|
||||
ID: ID,
|
||||
State: IDLE,
|
||||
output: NewOutput(),
|
||||
detail: &Detail{},
|
||||
process: process,
|
||||
Name: name,
|
||||
ID: ID,
|
||||
State: IDLE,
|
||||
resources: resources,
|
||||
wgTask: wgTask,
|
||||
}
|
||||
return task
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user