Documentation ¶
Rendered for js/wasm
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool struct { New func() interface{} // contains filtered or unexported fields }
A Pool is a set of temporary objects that may be individually saved and retrieved.
GopherJS provides a simpler, naive implementation with no synchronization at all. This is still correct for the GopherJS runtime because:
- JavaScript is single-threaded, so it is impossible for two threads to be accessing the pool at the same moment in time.
- GopherJS goroutine implementation uses cooperative multi-tasking model, which only allows passing control to other goroutines when the function might block.
TODO(nevkontakte): Consider adding a mutex just to be safe if it doesn't create a large performance hit.
Note: there is a special handling in the gopherjs/build package that filters out all original Pool implementation in order to avoid awkward unused fields referenced by dead code.
Click to show internal directories.
Click to hide internal directories.