implement task queue waiting for resources

This commit is contained in:
André Roth
2024-06-06 17:10:39 +02:00
parent 2d97ba2bbd
commit 45035802be
5 changed files with 92 additions and 50 deletions

View File

@@ -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
}