github.com/haraldrudell/parl@v0.4.176/go-id.go (about)

     1  /*
     2  © 2023–present Harald Rudell <harald.rudell@gmail.com> (https://haraldrudell.github.io/haraldrudell/)
     3  ISC License
     4  */
     5  
     6  package parl
     7  
     8  import (
     9  	"github.com/haraldrudell/parl/perrors"
    10  	"github.com/haraldrudell/parl/pruntime"
    11  	"github.com/haraldrudell/parl/pruntime/pruntimelib"
    12  )
    13  
    14  func goID() (threadID ThreadID) {
    15  	var ID, _, err = pruntimelib.ParseFirstLine(pruntime.FirstStackLine())
    16  	if perrors.IsPF(&err, "pruntime.ParseFirstLine %w", err) {
    17  		panic(err)
    18  	}
    19  	threadID = ThreadID(ID)
    20  
    21  	return
    22  }