mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 18:47:47 +00:00
feat: fix typos
This commit is contained in:
+13
-13
@@ -46,7 +46,7 @@ type channelBlockedList struct {
|
||||
|
||||
// t is the task associated with this channel operation.
|
||||
// If this channel operation is not part of a select, then the pointer field of the state holds the data buffer.
|
||||
// If this channel operation is part of a select, then the pointer field of the state holds the recieve buffer.
|
||||
// If this channel operation is part of a select, then the pointer field of the state holds the receive buffer.
|
||||
// If this channel operation is a receive, then the data field should be set to zero when resuming due to channel closure.
|
||||
t *task.Task
|
||||
|
||||
@@ -319,10 +319,10 @@ func (ch *channel) trySend(value unsafe.Pointer) bool {
|
||||
interrupt.Restore(i)
|
||||
return false
|
||||
case chanStateRecv:
|
||||
// unblock reciever
|
||||
// unblock receiver
|
||||
dst := ch.resumeRX(true)
|
||||
|
||||
// copy value to reciever
|
||||
// copy value to receiver
|
||||
memcpy(dst, value, ch.elementSize)
|
||||
|
||||
// change state to empty if there are no more receivers
|
||||
@@ -348,12 +348,12 @@ func (ch *channel) trySend(value unsafe.Pointer) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// try to recieve a value from a channel, without really blocking
|
||||
// returns whether a value was recieved
|
||||
// try to receive a value from a channel, without really blocking
|
||||
// returns whether a value was received
|
||||
// second return is the comma-ok value
|
||||
func (ch *channel) tryRecv(value unsafe.Pointer) (bool, bool) {
|
||||
if ch == nil {
|
||||
// recieve from nil channel blocks forever
|
||||
// receive from nil channel blocks forever
|
||||
// this is non-blocking, so just say no
|
||||
return false, false
|
||||
}
|
||||
@@ -402,7 +402,7 @@ func (ch *channel) tryRecv(value unsafe.Pointer) (bool, bool) {
|
||||
interrupt.Restore(i)
|
||||
return false, false
|
||||
case chanStateRecv, chanStateEmpty:
|
||||
// something else is already waiting to recieve
|
||||
// something else is already waiting to receive
|
||||
interrupt.Restore(i)
|
||||
return false, false
|
||||
case chanStateClosed:
|
||||
@@ -411,7 +411,7 @@ func (ch *channel) tryRecv(value unsafe.Pointer) (bool, bool) {
|
||||
return true, true
|
||||
}
|
||||
|
||||
// channel closed - nothing to recieve
|
||||
// channel closed - nothing to receive
|
||||
memzero(value, ch.elementSize)
|
||||
interrupt.Restore(i)
|
||||
return true, false
|
||||
@@ -426,8 +426,8 @@ func (ch *channel) tryRecv(value unsafe.Pointer) (bool, bool) {
|
||||
type chanState uint8
|
||||
|
||||
const (
|
||||
chanStateEmpty chanState = iota // nothing in channel, no senders/recievers
|
||||
chanStateRecv // nothing in channel, recievers waiting
|
||||
chanStateEmpty chanState = iota // nothing in channel, no senders/receivers
|
||||
chanStateRecv // nothing in channel, receivers waiting
|
||||
chanStateSend // senders waiting, buffer full if present
|
||||
chanStateBuf // buffer not empty, no senders waiting
|
||||
chanStateClosed // channel closed
|
||||
@@ -477,7 +477,7 @@ func chanSend(ch *channel, value unsafe.Pointer, blockedlist *channelBlockedList
|
||||
deadlock()
|
||||
}
|
||||
|
||||
// wait for reciever
|
||||
// wait for receiver
|
||||
sender := task.Current()
|
||||
ch.state = chanStateSend
|
||||
sender.Ptr = value
|
||||
@@ -493,8 +493,8 @@ func chanSend(ch *channel, value unsafe.Pointer, blockedlist *channelBlockedList
|
||||
}
|
||||
|
||||
// chanRecv receives a single value over a channel.
|
||||
// It blocks if there is no available value to recieve.
|
||||
// The recieved value is copied into the value pointer.
|
||||
// It blocks if there is no available value to receive.
|
||||
// The received value is copied into the value pointer.
|
||||
// Returns the comma-ok value.
|
||||
func chanRecv(ch *channel, value unsafe.Pointer, blockedlist *channelBlockedList) bool {
|
||||
i := interrupt.Disable()
|
||||
|
||||
Reference in New Issue
Block a user