Skip to content

Commit

Permalink
chore: eliminate the code for preventing false-sharing
Browse files Browse the repository at this point in the history
  • Loading branch information
panjf2000 committed Nov 21, 2021
1 parent cc085c5 commit 0bfade3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
10 changes: 0 additions & 10 deletions eventloop_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"os"
"sync/atomic"
"time"
"unsafe"

"golang.org/x/sys/unix"

Expand All @@ -36,15 +35,6 @@ import (
)

type eventloop struct {
internalEventloop

// Prevents eventloop from false sharing by padding extra memory with the difference
// between the cache line size "s" and (eventloop mod s) for the most common CPU architectures.
_ [64 - unsafe.Sizeof(internalEventloop{})%64]byte
}

//nolint:structcheck
type internalEventloop struct {
ln *listener // listener
idx int // loop index in the server loops list
svr *server // server in loop
Expand Down
10 changes: 0 additions & 10 deletions eventloop_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,13 @@ import (
"runtime"
"sync/atomic"
"time"
"unsafe"

"github.com/panjf2000/gnet/errors"
"github.com/panjf2000/gnet/logging"
"github.com/panjf2000/gnet/pool/bytebuffer"
)

type eventloop struct {
internalEventloop

// Prevents eventloop from false sharing by padding extra memory with the difference
// between the cache line size "s" and (eventloop mod s) for the most common CPU architectures.
_ [64 - unsafe.Sizeof(internalEventloop{})%64]byte
}

//nolint:structcheck
type internalEventloop struct {
ch chan interface{} // command channel
idx int // loop index
svr *server // server in loop
Expand Down

0 comments on commit 0bfade3

Please sign in to comment.