@@ -25,6 +25,8 @@ import (
2525 "os"
2626 "runtime"
2727 "sync"
28+
29+ "github.com/cloudwego/netpoll/internal/runner"
2830)
2931
3032var (
@@ -52,7 +54,7 @@ func Configure(config Config) (err error) {
5254 }
5355
5456 if config .Runner != nil {
55- setRunner ( config .Runner )
57+ runner . RunTask = config .Runner
5658 }
5759 if config .LoggerOutput != nil {
5860 logger = log .New (config .LoggerOutput , "" , log .LstdFlags )
@@ -99,19 +101,22 @@ func SetLoggerOutput(w io.Writer) {
99101}
100102
101103// SetRunner set the runner function for every OnRequest/OnConnect callback
102- // Deprecated: use Configure instead.
104+ //
105+ // Deprecated: use Configure and specify config.Runner instead.
103106func SetRunner (f func (ctx context.Context , f func ())) {
104- setRunner ( f )
107+ runner . RunTask = f
105108}
106109
107110// DisableGopool will remove gopool(the goroutine pool used to run OnRequest),
108111// which means that OnRequest will be run via `go OnRequest(...)`.
109112// Usually, OnRequest will cause stack expansion, which can be solved by reusing goroutine.
110113// But if you can confirm that the OnRequest will not cause stack expansion,
111114// it is recommended to use DisableGopool to reduce redundancy and improve performance.
112- // Deprecated: use Configure instead.
115+ //
116+ // Deprecated: use Configure() and specify config.Runner instead.
113117func DisableGopool () error {
114- return disableGopool ()
118+ runner .UseGoRunTask ()
119+ return nil
115120}
116121
117122// NewEventLoop .
0 commit comments