You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

future.go 345 B

2 years ago
2 years ago
2 years ago
12345678910111213141516171819202122232425
  1. package future
  2. import (
  3. "fmt"
  4. "time"
  5. )
  6. var ErrWaitTimeout = fmt.Errorf("wait timeout")
  7. type Future interface {
  8. Error() error
  9. IsComplete() bool
  10. Wait() error
  11. WaitTimeout(timeout time.Duration) error
  12. }
  13. type ValueFuture[T any] interface {
  14. Future
  15. Value() T
  16. WaitValue() (T, error)
  17. WaitValueTimeout(timeout time.Duration) (T, error)
  18. }

公共库

Contributors (1)