On Wed, Jun 7, 2023 at 5:13 AM 'Mikhail Gritsenko' via golang-nuts
<
golan...@googlegroups.com> wrote:
>
> Why does sudog struct for elem field for the second node in sendq of a chan hold unsafe.Pointer BUT the first node of the sendq holds actual value? Is it somehow related with sendDirect or this is just an address of a value that allocated on a stack of the sending goroutine?
Sorry, I'm not sure I understand the question. The sendq is just a
linked list of sudog structs. I'm not sure what you mean by the first
node. The elem field of a sudog is a pointer to the value being sent
on a channel (or a pointer to a place to put a value received from a
channel). That field is in the sudog so that the other end of the
channel can copy the value when performing a channel operation.
Ian