github.com/madokast/nopreempt@v1.0.3-0.20240125081507-3fa05aef38ed/README.md (about)

     1  # nopreempt
     2  
     3  Prevent Golang goroutine preemption. Ref. https://github.com/petermattis/goid 
     4  
     5  阻止 Go 协程抢占。参考 https://github.com/petermattis/goid 
     6  
     7  
     8  Usage:
     9  
    10  使用方法:
    11  
    12  ```golang
    13  func fun() {
    14  	mp := AcquireM()
    15  
    16  	// code will not be preempted
    17  	// ...
    18  
    19  	mp.Release()
    20  }
    21  ```
    22  
    23  Func GetGID() and GetMID() are also available.
    24  
    25  另外还提供 GetGID() 和 GetMID() 函数。