github.com/tursom/GoCollections@v0.3.10/concurrent/Util.go (about)

     1  /*
     2   * Copyright (c) 2022 tursom. All rights reserved.
     3   * Use of this source code is governed by a GPL-3
     4   * license that can be found in the LICENSE file.
     5   */
     6  
     7  package concurrent
     8  
     9  import (
    10  	"sync"
    11  
    12  	"github.com/petermattis/goid"
    13  )
    14  
    15  func GetGoroutineID() int64 {
    16  	return goid.Get()
    17  }
    18  
    19  func WaitCond(cond *sync.Cond) {
    20  	cond.L.Lock()
    21  	defer cond.L.Unlock()
    22  	cond.Wait()
    23  }