mirror of
				https://github.com/cloudreve/cloudreve.git
				synced 2025-10-31 16:49:03 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			25 lines
		
	
	
		
			324 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			324 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package queue
 | |
| 
 | |
| import "sync"
 | |
| 
 | |
| type routineGroup struct {
 | |
| 	waitGroup sync.WaitGroup
 | |
| }
 | |
| 
 | |
| func newRoutineGroup() *routineGroup {
 | |
| 	return new(routineGroup)
 | |
| }
 | |
| 
 | |
| func (g *routineGroup) Run(fn func()) {
 | |
| 	g.waitGroup.Add(1)
 | |
| 
 | |
| 	go func() {
 | |
| 		defer g.waitGroup.Done()
 | |
| 		fn()
 | |
| 	}()
 | |
| }
 | |
| 
 | |
| func (g *routineGroup) Wait() {
 | |
| 	g.waitGroup.Wait()
 | |
| }
 | 
