MCPcopy Create free account
hub / github.com/pion/ice / Run

Method Run

internal/taskloop/taskloop.go:80–95  ·  view source on GitHub ↗

Run serially executes the submitted callback. Blocking tasks must be cancelable by context.

(ctx context.Context, t func(context.Context))

Source from the content-addressed store, hash-verified

78// Run serially executes the submitted callback.
79// Blocking tasks must be cancelable by context.
80func (l *Loop) Run(ctx context.Context, t func(context.Context)) error {
81 if err := l.Err(); err != nil {
82 return err
83 }
84 done := make(chan struct{})
85 select {
86 case <-ctx.Done():
87 return ctx.Err()
88 case <-l.done:
89 return ErrClosed
90 case l.tasks <- task{t, done}:
91 <-done
92
93 return nil
94 }
95}
96
97// The following methods implement context.Context for TaskLoop
98

Calls 2

ErrMethod · 0.95
DoneMethod · 0.45