Refactoring of the default values

This commit is contained in:
Eric Coissac
2025-01-24 18:09:59 +01:00
parent 3137c1f841
commit 9acb4a85a8
50 changed files with 337 additions and 166 deletions

View File

@ -16,39 +16,6 @@ import (
"github.com/tevino/abool/v2"
)
var globalLocker sync.WaitGroup
var globalLockerCounter = 0
// RegisterAPipe increments the global lock counter and adds a new pipe to the global wait group.
//
// No parameters.
// No return values.
func RegisterAPipe() {
globalLocker.Add(1)
globalLockerCounter++
log.Debugln(globalLockerCounter, " Pipes are registered now")
}
// UnregisterPipe decrements the global lock counter and signals that a pipe has finished.
//
// No parameters.
// No return values.
func UnregisterPipe() {
globalLocker.Done()
globalLockerCounter--
log.Debugln(globalLockerCounter, "are still registered")
}
// WaitForLastPipe waits until all registered pipes have finished.
//
// THe function have to be called at the end of every main function.
//
// No parameters.
// No return values.
func WaitForLastPipe() {
globalLocker.Wait()
}
// Structure implementing an iterator over bioseq.BioSequenceBatch
// based on a channel.
type _IBioSequence struct {
@ -92,7 +59,7 @@ func MakeIBioSequence() IBioSequence {
i.lock = &lock
ii := IBioSequence{&i}
RegisterAPipe()
obiutils.RegisterAPipe()
return ii
}
@ -259,7 +226,7 @@ func (iterator IBioSequence) Push(batch BioSequenceBatch) {
func (iterator IBioSequence) Close() {
close(iterator.pointer.channel)
UnregisterPipe()
obiutils.UnregisterPipe()
}
func (iterator IBioSequence) WaitAndClose() {