Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为什么用这个b unsafe.Pointer 而不用这个*bucket #47

Open
EddieChan1993 opened this issue Jun 8, 2023 · 1 comment
Open

为什么用这个b unsafe.Pointer 而不用这个*bucket #47

EddieChan1993 opened this issue Jun 8, 2023 · 1 comment

Comments

@EddieChan1993
Copy link

// Timer represents a single event. When the Timer expires, the given
// task will be executed.
type Timer struct {
   expiration int64 // in milliseconds
   task       func()

   // The bucket that holds the list to which this timer's element belongs.
   //
   // NOTE: This field may be updated and read concurrently,
   // through Timer.Stop() and Bucket.Flush().
   b unsafe.Pointer // type: *bucket

   // The timer's element.
   element *list.Element
}

有什么考究吗?

@M6ZeroG
Copy link

M6ZeroG commented Dec 23, 2024

因为要使用atomic.LoadPointer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants