From f9204e9924a1d175251563cf264677488567ae4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Thu, 3 Apr 2025 16:41:30 +0900 Subject: [PATCH] fix: ensure atomic alignment --- item.go | 6 ++++-- pbuf/pooler.go | 2 +- pool.go | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/item.go b/item.go index a32a6ad..684335f 100644 --- a/item.go +++ b/item.go @@ -12,9 +12,11 @@ import ( // You must always use the given methods. type Item[T any] struct { pool *Pool[T] - cfg any - stat status + // align 64 + + cfg any + // align 64 val T } diff --git a/pbuf/pooler.go b/pbuf/pooler.go index 4c0ace9..dd02ecc 100644 --- a/pbuf/pooler.go +++ b/pbuf/pooler.go @@ -9,8 +9,8 @@ import ( // UserBuffer with customizable user data structure inside. type UserBuffer[USRDAT any] struct { - bytes.Buffer DAT USRDAT + bytes.Buffer } type bufpooler[USRDAT any] struct{} diff --git a/pool.go b/pool.go index af0a305..782c296 100644 --- a/pool.go +++ b/pool.go @@ -9,10 +9,10 @@ import ( // Pool lightweight general pool. type Pool[T any] struct { - pooler Pooler[T] - pool sync.Pool countin int32 countout int32 + pooler Pooler[T] + pool sync.Pool noputbak bool manudstr bool }