kataras / go-events Goto Github PK
View Code? Open in Web Editor NEW:mega: Pure nodejs EventEmmiter for the Go Programming Language.
License: MIT License
:mega: Pure nodejs EventEmmiter for the Go Programming Language.
License: MIT License
Even though AddListener protects the map on write, Emit does not protect it on read. This can result in panics, as seen below:
fatal error: concurrent map read and map write
goroutine 2929 [running]:
runtime.throw(0xf7c620, 0x21)
/home/plorenz/.gvm/gos/go1.14.7/src/runtime/panic.go:1116 +0x72 fp=0xc001757c60 sp=0xc001757c30 pc=0x438c82
runtime.mapaccess1_faststr(0xe453a0, 0xc0003aa360, 0xf6d2b3, 0x13, 0x10)
/home/plorenz/.gvm/gos/go1.14.7/src/runtime/map_faststr.go:21 +0x43c fp=0xc001757cd0 sp=0xc001757c60 pc=0x41717c
github.com/kataras/go-events.(*emmiter).Emit(0xc0003ddc60, 0xf6d2b3, 0x13, 0xc00174a260, 0x1, 0x1)
/home/plorenz/work/nf/build/pkg/mod/github.com/kataras/[email protected]/events.go:148 +0x5c fp=0xc001757d20 sp=0xc001757cd0 pc=0xaba60c
github.com/openziti/edge/gateway/internal/fabric.(*StateManagerImpl).AddSession(0xc000136360, 0xc0015c1480)
/home/plorenz/work/nf/build/pkg/mod/github.com/openziti/[email protected]/gateway/internal/fabric/manager.go:149 +0x3ad fp=0xc001757e50 sp=0xc001757d20 pc=0xd0604d
github.com/openziti/edge/gateway/handler_edge_ctrl.(*sessionAddedHandler).HandleReceive.func1(0xc0019404b0, 0xc0003b01e0)
/home/plorenz/work/nf/build/pkg/mod/github.com/openziti/[email protected]/gateway/handler_edge_ctrl/sessionAdded.go:48 +0x1af fp=0xc001757fd0 sp=0xc001757e50 pc=0xd0bbff
runtime.goexit()
/home/plorenz/.gvm/gos/go1.14.7/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc001757fd8 sp=0xc001757fd0 pc=0x4699f1
created by github.com/openziti/edge/gateway/handler_edge_ctrl.(*sessionAddedHandler).HandleReceive
/home/plorenz/work/nf/build/pkg/mod/github.com/openziti/[email protected]/gateway/handler_edge_ctrl/sessionAdded.go:43 +0x49
Calling the RemoveListener event in the Emit event will cause a deadlock:
foo := func(...any){
}
event.On("test", func(...any){
event.RemoveListener("other",foo)
})
event.Emit("test")
Current implementation does not support 'removeListener' method.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.