Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
tarantool
Commits
4b5cccb6
Commit
4b5cccb6
authored
10 years ago
by
Roman Tsisyk
Browse files
Options
Downloads
Patches
Plain Diff
Remove unused methods in Lua bindings to fiber
Follow up
fdc3d1dd
commit
parent
382b6937
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lua/fiber.cc
+1
-56
1 addition, 56 deletions
src/lua/fiber.cc
with
1 addition
and
56 deletions
src/lua/fiber.cc
+
1
−
56
View file @
4b5cccb6
...
...
@@ -79,8 +79,6 @@ extern "C" {
static
const
char
*
fiberlib_name
=
"fiber"
;
enum
fiber_state
{
DONE
,
YIELD
};
/**
* @pre: stack top contains a table
* @post: sets table field specified by name of the table on top
...
...
@@ -189,66 +187,13 @@ lbox_fiber_id(struct lua_State *L)
return
1
;
}
static
struct
lua_State
*
box_lua_fiber_get_coro
(
struct
lua_State
*
L
,
struct
fiber
*
f
)
{
lua_pushlightuserdata
(
L
,
f
);
lua_gettable
(
L
,
LUA_REGISTRYINDEX
);
struct
lua_State
*
child_L
=
lua_tothread
(
L
,
-
1
);
lua_pop
(
L
,
1
);
return
child_L
;
}
static
void
box_lua_fiber_clear_coro
(
struct
lua_State
*
L
,
struct
fiber
*
f
)
{
lua_pushlightuserdata
(
L
,
f
);
lua_pushnil
(
L
);
lua_settable
(
L
,
LUA_REGISTRYINDEX
);
}
static
int
lbox_fiber_gc
(
struct
lua_State
*
L
)
{
if
(
lua_gettop
(
L
)
==
0
)
return
0
;
struct
fiber
*
f
=
lbox_isfiber
(
L
,
1
);
if
(
f
==
NULL
)
return
0
;
struct
lua_State
*
child_L
=
box_lua_fiber_get_coro
(
L
,
f
);
/*
* A non-NULL coro is an indicator of a 1) alive,
* 2) suspended and 3) attached fiber. The coro is
* an outlet to pass arguments in and out the Lua
* routine being executed by the fiber (see fiber.resume()
* and fiber.yield()), and as soon as the Lua routine
* completes, the "plug" is shut down (see
* box_lua_fiber_run()). When its routine completes,
* the fiber recycles itself.
* Likewise, when a fiber becomes detached, this plug is
* removed, since we no longer need to pass arguments
* to and from it, and 'sched' garbage collects all detached
* fibers (see lbox_fiber_detach()).
* We also know that the fiber is suspended, not running,
* because any running and attached fiber is referenced,
* if only by the fiber which called lbox_lua_resume()
* on it. lbox_lua_resume() is the only entry point
* to resume an attached fiber.
*/
if
(
child_L
)
{
assert
(
f
!=
fiber
()
&&
child_L
!=
L
);
/*
* Garbage collect the associated coro.
* Do it first, since the cancelled fiber
* can get recycled quickly.
*/
box_lua_fiber_clear_coro
(
L
,
f
);
/*
* Cancel and recycle the fiber. This
* returns only after the fiber has died.
*/
fiber_cancel
(
f
);
}
(
void
)
f
;
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment