最近,我一直在深入研究Go的源代码.当我查看sync.Pool的细节时,我发现了一条我无法理解的评论.
https://golang.org/src/sync/pool.go?s=1633:1992#L58
// Local per-P Pool appendix.
type poolLocalInternal struct {
private interface{} // Can be used only by the respective P.
shared []interface{} // Can be used by any P.
Mutex // Protects shared.
}
Run Code Online (Sandbox Code Playgroud)
本地per-P Pool附录.
per-P是什么意思?
只能由相应的P使用
P是什么意思?
我已经按照angular2的官方指南来学习angular2.当我使用angular2-alpha28时,一切顺利!当将angular2更改为alpha36时,它无法工作!它显示以下错误:
EXCEPTION: Error during instantiation of Token(Promise<ComponentRef>)!.
angular2.dev.js:22746 ORIGINAL EXCEPTION: TypeError: Cannot read property 'toString' of undefined
angular2.dev.js:22746 ORIGINAL STACKTRACE:
angular2.dev.js:22746 TypeError: Cannot read property 'toString' of undefined
at new InvalidBindingError (angular2.dev.js:9171)
at _resolveBindings (angular2.dev.js:27377)
at Function.execute.Injector.resolve (angular2.dev.js:28030)
at Function.execute.DirectiveBinding.createFromBinding (angular2.dev.js:28611)
at Function.execute.DirectiveBinding.createFromType (angular2.dev.js:28643)
at execute.Compiler._bindDirective (angular2.dev.js:29892)
at execute.Compiler.compileInHost (angular2.dev.js:29908)
at execute.DynamicComponentLoader.loadAsRoot (angular2.dev.js:17421)
at angular2.dev.js:30555
at Injector.execute.Injector._instantiate (angular2.dev.js:27893)
Run Code Online (Sandbox Code Playgroud)
这是我的ts代码:
/// <reference path="typings/angular2/angular2.d.ts" />
import { Component, View, bootstrap, NgFor, NgIf, Inject, forwardRef} from 'angular2/angular2';
@Component({
selector: "my-app",
bindings: [FriendsService]
}) …Run Code Online (Sandbox Code Playgroud)