From 89e2b5f0bbbf9b2e3e6bc7f30a12e28e7109d82b Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Sun, 2 Apr 2023 13:47:57 +0200 Subject: Fix bug where a few input lines are skipped --- internal/line/line.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 internal/line/line.go (limited to 'internal/line') diff --git a/internal/line/line.go b/internal/line/line.go new file mode 100644 index 0000000..02dbbcc --- /dev/null +++ b/internal/line/line.go @@ -0,0 +1,22 @@ +package line + +import "sync" + +type Line struct { + sync.Mutex + num int64 +} + +func (l *Line) Inc() { + l.Lock() + defer l.Unlock() + + l.num++ +} + +func (l *Line) Num() int64 { + l.Lock() + defer l.Unlock() + + return l.num +} -- cgit v1.2.3