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
99b8ba83
Commit
99b8ba83
authored
13 years ago
by
Konstantin Osipov
Browse files
Options
Downloads
Patches
Plain Diff
Blueprint 'lua-fiber-status': review comments.
Update style, add comments.
parent
f8bdad7b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/fiber.m
+5
-1
5 additions, 1 deletion
core/fiber.m
core/tarantool_lua.m
+23
-19
23 additions, 19 deletions
core/tarantool_lua.m
with
28 additions
and
20 deletions
core/fiber.m
+
5
−
1
View file @
99b8ba83
...
@@ -251,10 +251,14 @@ fiber_yield(void)
...
@@ -251,10 +251,14 @@ fiber_yield(void)
coro_transfer
(
&
caller
->
coro
.
ctx
,
&
callee
->
coro
.
ctx
);
coro_transfer
(
&
caller
->
coro
.
ctx
,
&
callee
->
coro
.
ctx
);
}
}
/**
* Return true if the current fiber is a callee of fiber f,
* false otherwise.
*/
bool
bool
fiber_is_caller
(
struct
fiber
*
f
)
fiber_is_caller
(
struct
fiber
*
f
)
{
{
/* '
u
nwinding' fiber
's
stack */
/* '
U
nwinding'
the
fiber stack
.
*/
for
(
struct
fiber
**
sp_ptr
=
sp
;
sp_ptr
>
call_stack
;
--
sp_ptr
)
{
for
(
struct
fiber
**
sp_ptr
=
sp
;
sp_ptr
>
call_stack
;
--
sp_ptr
)
{
if
(
f
==
*
sp_ptr
)
if
(
f
==
*
sp_ptr
)
return
true
;
return
true
;
...
...
This diff is collapsed.
Click to expand it.
core/tarantool_lua.m
+
23
−
19
View file @
99b8ba83
...
@@ -518,32 +518,36 @@ lbox_fiber_yield(struct lua_State *L)
...
@@ -518,32 +518,36 @@ lbox_fiber_yield(struct lua_State *L)
}
}
/**
/**
*
Get
fiber
status
*
Get
fiber
status
.
*
This
follows
the
rules
of
Lua
coroutine
.
status
()
function
:
*
Returns
the
status
of
fibier
,
as
a
string
:
*
-
"running"
,
if
the
fiber
is
running
(
that
is
,
it
called
status
)
;
*
-
"suspended"
,
if
the
fiber
is
suspended
in
a
call
to
yield
()
,
*
or
if
it
has
not
started
running
yet
;
*
-
"normal"
if
the
fiber
is
active
but
not
running
(
that
is
,
*
it
has
resumed
another
fiber
)
;
*
-
"dead"
if
the
fiber
has
finished
its
body
function
,
or
if
it
*
has
stopped
with
an
error
.
*/
*/
static
int
static
int
lbox
_
fiber
_
status
(
struct
lua
_
State
*
L
)
lbox
_
fiber
_
status
(
struct
lua
_
State
*
L
)
{
{
struct
fiber
*
f
=
lbox
_
checkfiber
(
L
,
1
)
;
struct
fiber
*
f
=
lbox
_
checkfiber
(
L
,
1
)
;
const
char
*
status
;
if
(
f
->
fid
==
0
)
{
if
(
f
->
fid
==
0
)
{
/*
this
fiber
is
dead
*/
/*
This
fiber
is
dead
.
*/
lua
_
pushstring
(
L
,
"dead"
)
;
status
=
"dead"
;
return
1
;
}
else
if
(
f
==
fiber
)
{
}
/*
The
fiber
is
the
current
running
fiber
.
*/
status
=
"running"
;
if
(
f
==
fiber
)
{
}
else
if
(
fiber
_
is
_
caller
(
f
))
{
/*
the
fiber
is
current
running
fiber
*/
/*
The
fiber
is
current
fiber
'
s
caller
.
*/
lua
_
pushstring
(
L
,
"running"
)
;
status
=
"normal"
;
return
1
;
}
else
{
/*
None
of
the
above
:
must
be
suspended
.
*/
status
=
"suspended"
;
}
}
lua
_
pushstring
(
L
,
status
)
;
if
(
fiber
_
is
_
caller
(
f
))
{
/*
the
fiber
is
current
fiber
caller
*/
lua
_
pushstring
(
L
,
"normal"
)
;
return
1
;
}
/*
the
fiber
is
sleeping
*/
lua
_
pushstring
(
L
,
"suspended"
)
;
return
1
;
return
1
;
}
}
...
...
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