Skip to content

Conversation

@asteurer
Copy link
Contributor

No description provided.

Signed-off-by: Andrew Steurer <94206073+asteurer@users.noreply.github.com>
@asteurer asteurer requested a review from ricochet January 28, 2026 20:12
@asteurer asteurer merged commit 286ba0d into bytecodealliance:main Jan 28, 2026
5 checks passed
@asteurer asteurer deleted the pkg branch January 28, 2026 20:50
"go.bytecodealliance.org/wit_runtime"
)

const EVENT_NONE uint32 = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: constants should use iota:

const (
      EVENT_NONE = iota
      EVENT_SUBTASK
      EVENT_STREAM_READ
      // etc

<head>
<title>go.bytecodealliance.org/cmd</title>
<meta name="go-import" content="go.bytecodealliance.org git https://github.com/bytecodealliance/componentize-go" />
<meta http-equiv="refresh" content="0; url=https://pkg.go.dev/go.bytecodealliance.org/wit_async">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does make me want to go ahead and bring over the wit package from go-modules so that we can do wit/async, wit/runtime, wit/types

return offset
}

// Notify the host that the StreamReader is no longer being used.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be StreamWriter

}
pinner.Pin(buffer)

code, count := wit_async.FutureOrStreamWait(self.vtable.Read(handle, buffer, uint32(len(dst))), handle)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this handles cancellation. Falls through to return count even for unexpected return codes. Consider adding an explicit panic or error handling for unknown codes.

runtime.AddCleanup(value, func(_ int) {
handleValue := handle.TakeOrNil()
if handleValue != 0 {
vtable.DropReadable(handleValue)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be DropWritable

runtime.AddCleanup(value, func(_ int) {
handleValue := handle.TakeOrNil()
if handleValue != 0 {
vtable.DropReadable(handleValue)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, seems like this should be DropWritable

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

Successfully merging this pull request may close these issues.

2 participants