github.com/haraldrudell/parl@v0.4.176/pdebug/parse-first-line.go (about)

     1  /*
     2  © 2022–present Harald Rudell <harald.rudell@gmail.com> (https://haraldrudell.github.io/haraldrudell/)
     3  ISC License
     4  */
     5  
     6  package pdebug
     7  
     8  import (
     9  	"github.com/haraldrudell/parl"
    10  	"github.com/haraldrudell/parl/perrors"
    11  	"github.com/haraldrudell/parl/pruntime/pruntimelib"
    12  )
    13  
    14  // getID obtains gorutine ID, as of go1.18 a numeric string "1"…
    15  func ParseFirstLine(debugStack []byte) (ID parl.ThreadID, status parl.ThreadStatus, err error) {
    16  
    17  	var uID uint64
    18  	var status0 string
    19  	if uID, status0, err = pruntimelib.ParseFirstLine(debugStack); err != nil {
    20  		err = perrors.Stack(err)
    21  		return
    22  	}
    23  	ID = parl.ThreadID(uID)
    24  	status = parl.ThreadStatus(status0)
    25  
    26  	return
    27  }