Initial release.

This commit is contained in:
David Braun 2017-10-06 21:01:34 -04:00
commit 8c599e8e5c
No known key found for this signature in database
GPG key ID: 5694EEC4D129BDCF
13 changed files with 3651 additions and 0 deletions

33
test/go/goroutines.js Normal file
View file

@ -0,0 +1,33 @@
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Torture test for goroutines.
// Make a lot of goroutines, threaded together, and tear them down cleanly.
'use strict'
const Channel = require('../../lib')
it(`goroutines`, async function () {
const f = async (left, right) => {
await left.push(await right.shift())
}
const n = 10000
const leftmost = Channel()
let right = leftmost
let left = leftmost
for (let i = 0; i < n; i++) {
right = Channel()
f(left, right)
left = right
}
;(async (c) => {
await c.push(1)
})(right)
await leftmost.shift()
})