summaryrefslogtreecommitdiff
path: root/internal/syncpool/syncpool.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/syncpool/syncpool.go')
-rw-r--r--internal/syncpool/syncpool.go19
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]()