Skip to content

Commit

Permalink
content: publish zero-alloc-call-sched
Browse files Browse the repository at this point in the history
  • Loading branch information
changkun committed Jan 26, 2021
1 parent 4070d20 commit 04b7e85
Show file tree
Hide file tree
Showing 7 changed files with 205 additions and 103 deletions.
4 changes: 1 addition & 3 deletions content/assets/zero-alloc-call-sched/app-naive/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package app

import (
mainthread "x/mainthread-opt2"
"x/thread"

"github.com/go-gl/glfw/v3.3/glfw"
)
Expand All @@ -26,7 +25,6 @@ func Terminate() {
// Win is a window.
type Win struct {
win *glfw.Window
th *thread.Thread
}

// NewWindow constructs a new graphical window.
Expand All @@ -52,8 +50,8 @@ func NewWindow() (*Win, error) {
// Run runs the given window and blocks until it is destroied.
func (w *Win) Run() {
for !w.win.ShouldClose() {
w.win.SwapBuffers()
mainthread.Call(func() {
w.win.SwapBuffers()
// This function must be called from the main thread.
glfw.WaitEventsTimeout(1.0 / 30)
})
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 04b7e85

Please sign in to comment.