File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -2,10 +2,12 @@ package consumer
2
2
3
3
import (
4
4
"context"
5
+ "log"
6
+ "sync"
7
+
5
8
"github.com/mozillazg/ptcpdump/bpf"
6
9
"github.com/mozillazg/ptcpdump/internal/event"
7
10
"github.com/mozillazg/ptcpdump/internal/metadata"
8
- "log"
9
11
)
10
12
11
13
type ExecEventConsumer struct {
@@ -19,6 +21,18 @@ func NewExecEventConsumer(pcache *metadata.ProcessCache) *ExecEventConsumer {
19
21
}
20
22
21
23
func (c * ExecEventConsumer ) Start (ctx context.Context , ch <- chan bpf.BpfExecEventT ) {
24
+ wg := sync.WaitGroup {}
25
+ for i := 0 ; i < 5 ; i ++ {
26
+ wg .Add (1 )
27
+ go func () {
28
+ defer wg .Done ()
29
+ c .worker (ctx , ch )
30
+ }()
31
+ }
32
+ wg .Wait ()
33
+ }
34
+
35
+ func (c * ExecEventConsumer ) worker (ctx context.Context , ch <- chan bpf.BpfExecEventT ) {
22
36
for {
23
37
select {
24
38
case <- ctx .Done ():
You can’t perform that action at this time.
0 commit comments