diff options
| author | Paul Buetow <paul@buetow.org> | 2024-02-16 21:41:31 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-02-16 21:41:31 +0200 |
| commit | ec6ad4983ca023842cc5c780a723b753bf55518b (patch) | |
| tree | 84c7e315696abaf9b098180137038b7bcec66e99 /internal/syncpool | |
| parent | fd2875f21834124da576e7284f314f1d087cac31 (diff) | |
refactor to syncpool
Diffstat (limited to 'internal/syncpool')
| -rw-r--r-- | internal/syncpool/syncpool.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/internal/syncpool/syncpool.go b/internal/syncpool/syncpool.go new file mode 100644 index 0000000..c41034f --- /dev/null +++ b/internal/syncpool/syncpool.go @@ -0,0 +1,19 @@ +package syncpool + +import ( + "ioriotng/internal/types" + "sync" +) + +func syncPool[T any]() sync.Pool { + return sync.Pool{ + New: func() interface{} { + var value T + return &value + }, + } +} + +var OpenEnterEvent = syncPool[types.OpenatEnterEvent]() +var FdEvent = syncPool[types.FdEvent]() +var NullEvent = syncPool[types.NullEvent]() |
