Use LockOSThread

This commit is contained in:
DataHoarder 2022-02-01 15:38:45 +01:00
parent b0d46ec375
commit faddd6ec92

View file

@ -12,6 +12,7 @@ import "C"
import (
"fmt"
"log"
"runtime"
"runtime/cgo"
"unsafe"
)
@ -57,6 +58,8 @@ func (g *Gaborator) GaborBlockTransform(source chan []float32) (channel chan []f
channel = g.GetChannel()
go func() {
runtime.LockOSThread()
defer runtime.UnlockOSThread()
defer g.ProcessingFinished()
for {
@ -84,6 +87,8 @@ func (g *Gaborator) GaborTransform(source chan float32) (channel chan []float32)
channel = g.GetChannel()
go func() {
runtime.LockOSThread()
defer runtime.UnlockOSThread()
defer g.ProcessingFinished()
audioData := make([]float32, 0, g.audioBlockSize)