From bad6c4655200dacd75ce1451cd3f410fea3d8de2 Mon Sep 17 00:00:00 2001 From: Will Hawkins Date: Sun, 20 Nov 2022 02:33:51 -0500 Subject: [Feature] Add structure for wrapping collection of LGCs Add a structure for wrapping a collection of load-generating connections so that two or more parallel tasks can access them safely. --- lgc/lgc.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lgc') diff --git a/lgc/lgc.go b/lgc/lgc.go index b4a632c..d61ddf2 100644 --- a/lgc/lgc.go +++ b/lgc/lgc.go @@ -22,6 +22,7 @@ import ( "io/ioutil" "net/http" "net/http/httptrace" + "sync" "sync/atomic" "time" @@ -41,6 +42,15 @@ type LoadGeneratingConnection interface { Stats() *stats.TraceStats } +type LoadGeneratingConnectionCollection struct { + Lock sync.Mutex + LGCs *[]LoadGeneratingConnection +} + +func NewLoadGeneratingConnectionCollection() LoadGeneratingConnectionCollection { + return LoadGeneratingConnectionCollection{LGCs: new([]LoadGeneratingConnection)} +} + // TODO: All 64-bit fields that are accessed atomically must // appear at the top of this struct. type LoadGeneratingConnectionDownload struct { -- cgit v1.2.3