Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for GetNonBlocking (0.1 sec)

  1. internal/once/singleton.go

    }
    
    // Get will return the singleton value.
    func (s *Singleton[T]) Get() *T {
    	<-s.set
    	return s.v
    }
    
    // GetNonBlocking will return the singleton value or nil if not set yet.
    func (s *Singleton[T]) GetNonBlocking() *T {
    	select {
    	case <-s.set:
    		return s.v
    	default:
    		return nil
    	}
    }
    
    // IsSet will return whether the singleton has been set.
    Registered: Sun Oct 27 19:28:09 UTC 2024
    - Last Modified: Thu Aug 15 12:04:40 UTC 2024
    - 952 bytes
    - Viewed (0)
Back to top