Skip to content
Snippets Groups Projects
Commit d7321cb5 authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

Lua: implement 'memoize' pattern for fiber userdata.

Creating a new userdata object whenever a fiber is accessed
is inefficient and complicates fiber garbage collection:
if a fiber is referenced to by multiple userdata instances,
it's hard to know when to free it up. Implement
'memoize' pattern for fiber userdata to deal with
these two issues.

After this patch, no matter how and where from
one gets a reference to a fiber, it's the same
userdata object.

As a side effect, getting fiber identity in Lua
is also easy -- one can just directly compare two
fibers to tell whether or not they are the same.
parent 06d2ef67
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment