From 010767fabb8ee117c6757dd23a2d89dad45924b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Roth?= Date: Tue, 9 Jun 2026 10:09:41 +0200 Subject: [PATCH] tasks: show resources --- task/list.go | 8 ++++---- task/task.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/task/list.go b/task/list.go index 4af459cd..6a1a720d 100644 --- a/task/list.go +++ b/task/list.go @@ -67,7 +67,7 @@ func (list *List) consumer() { task.processReturnValue = retValue } - list.usedResources.Free(task.resources) + list.usedResources.Free(task.Resources) task.wgTask.Done() list.wg.Done() @@ -76,9 +76,9 @@ func (list *List) consumer() { for _, t := range list.tasks { if t.State == IDLE { // check resources - blockingTasks := list.usedResources.UsedBy(t.resources) + blockingTasks := list.usedResources.UsedBy(t.Resources) if len(blockingTasks) == 0 { - list.usedResources.MarkInUse(t.resources, t) + list.usedResources.MarkInUse(t.Resources, t) // unlock list since queueing may block list.Unlock() unlocked = true @@ -219,7 +219,7 @@ func (list *List) RunTaskInBackground(name string, resources []string, process P // if not, task will be queued by the consumer once resources are available tasks := list.usedResources.UsedBy(resources) if len(tasks) == 0 { - list.usedResources.MarkInUse(task.resources, task) + list.usedResources.MarkInUse(task.Resources, task) // queueing task might block if channel not ready, unlock list before queueing list.Unlock() list.queue <- task diff --git a/task/task.go b/task/task.go index 04829675..72f60699 100644 --- a/task/task.go +++ b/task/task.go @@ -52,7 +52,7 @@ type Task struct { Name string ID int State State - resources []string + Resources []string wgTask *sync.WaitGroup } @@ -65,7 +65,7 @@ func NewTask(process Process, name string, ID int, resources []string, wgTask *s Name: name, ID: ID, State: IDLE, - resources: resources, + Resources: resources, wgTask: wgTask, } return task