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
a2cd0ca2
Commit
a2cd0ca2
authored
10 years ago
by
Konstantin Osipov
Browse files
Options
Downloads
Patches
Plain Diff
Style fixes in fiber.h.
parent
6b7bbd73
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/fiber.h
+70
-35
70 additions, 35 deletions
src/fiber.h
with
70 additions
and
35 deletions
src/fiber.h
+
70
−
35
View file @
a2cd0ca2
...
...
@@ -46,21 +46,28 @@
#endif
/* defined(__cplusplus) */
#include
"salad/rlist.h"
#define FIBER_NAME_MAX REGION_NAME_MAX
#define FIBER_READING_INBOX (1 << 0)
/** This fiber can be cancelled synchronously. */
#define FIBER_CANCELLABLE (1 << 1)
/** Indicates that a fiber has been cancelled. */
#define FIBER_CANCEL (1 << 2)
/** This fiber was created via stored procedures API. */
#define FIBER_USER_MODE (1 << 3)
/** This fiber was marked as ready for wake up */
#define FIBER_READY (1 << 4)
/** This is thrown by fiber_* API calls when the fiber is
enum
{
FIBER_NAME_MAX
=
REGION_NAME_MAX
};
enum
{
/**
* It's safe to resume (wakeup) this fiber
* with a spurious wakeup if it is suspended
* (e.g. to force it to check that it's been
* cancelled).
*/
FIBER_CANCELLABLE
=
1
<<
0
,
/** Indicates that a fiber has been cancelled. */
FIBER_CANCEL
=
1
<<
1
,
/** This fiber was created via stored procedures API. */
FIBER_USER_MODE
=
1
<<
2
,
/** This fiber was marked as ready for wake up */
FIBER_READY
=
1
<<
3
,
};
/**
* This is thrown by fiber_* API calls when the fiber is
* cancelled.
*/
#if defined(__cplusplus)
class
FiberCancelException
:
public
Exception
{
public:
...
...
@@ -214,9 +221,15 @@ cord_destroy(struct cord *cord);
void
fiber_init
(
void
);
void
fiber_free
(
void
);
typedef
void
(
*
fiber_func
)(
va_list
);
struct
fiber
*
fiber_new
(
const
char
*
name
,
fiber_func
f
);
void
fiber_set_name
(
struct
fiber
*
fiber
,
const
char
*
name
);
int
wait_for_child
(
pid_t
pid
);
struct
fiber
*
fiber_new
(
const
char
*
name
,
fiber_func
f
);
void
fiber_set_name
(
struct
fiber
*
fiber
,
const
char
*
name
);
int
wait_for_child
(
pid_t
pid
);
static
inline
const
char
*
fiber_name
(
struct
fiber
*
f
)
...
...
@@ -227,40 +240,62 @@ fiber_name(struct fiber *f)
bool
fiber_checkstack
();
void
fiber_yield
(
void
);
void
fiber_yield_to
(
struct
fiber
*
f
);
void
fiber_yield
(
void
);
void
fiber_yield_to
(
struct
fiber
*
f
);
/**
* @brief yield & check for timeout
* @return true if timeout exceeded
*/
bool
fiber_yield_timeout
(
ev_tstamp
delay
);
bool
fiber_yield_timeout
(
ev_tstamp
delay
);
void
fiber_destroy_all
();
void
fiber_destroy_all
();
void
fiber_gc
(
void
);
void
fiber_gc
(
void
);
void
fiber_call
(
struct
fiber
*
callee
,
...);
void
fiber_wakeup
(
struct
fiber
*
f
);
struct
fiber
*
fiber_find
(
uint32_t
fid
);
/** Cancel a fiber. A cancelled fiber will have
void
fiber_call
(
struct
fiber
*
callee
,
...);
void
fiber_wakeup
(
struct
fiber
*
f
);
struct
fiber
*
fiber_find
(
uint32_t
fid
);
/**
* Cancel a fiber. A cancelled fiber will have
* tnt_FiberCancelException raised in it.
*
* A fiber can be cancelled only if it is
* FIBER_CANCELLABLE flag is set.
*/
void
fiber_cancel
(
struct
fiber
*
f
);
/** Check if the current fiber has been cancelled. Raises
void
fiber_cancel
(
struct
fiber
*
f
);
/**
* Check if the current fiber has been cancelled. Raises
* tnt_FiberCancelException
*/
void
fiber_testcancel
(
void
);
/** Make it possible or not possible to cancel the current
* fiber.
void
fiber_testcancel
(
void
);
/**
* Make it possible or not possible to wakeup the current
* fiber immediately when it's cancelled.
*
* return previous state.
*
@
return previous state.
*/
bool
fiber_setcancellable
(
bool
enable
);
void
fiber_sleep
(
ev_tstamp
s
);
bool
fiber_setcancellable
(
bool
yesno
);
void
fiber_sleep
(
ev_tstamp
s
);
void
fiber_schedule
(
ev_loop
*
/* loop */
,
ev_watcher
*
watcher
,
int
revents
);
...
...
@@ -299,9 +334,9 @@ fiber_get_key(struct fiber *fiber, enum fiber_key key)
* \sa fiber_key_on_gc()
*/
typedef
void
(
*
fiber_key_gc_cb
)(
enum
fiber_key
key
,
void
*
arg
);
typedef
int
(
*
fiber_stat_cb
)(
struct
fiber
*
f
,
void
*
ctx
);
int
fiber_stat
(
fiber_stat_cb
cb
,
void
*
cb_ctx
);
int
fiber_stat
(
fiber_stat_cb
cb
,
void
*
cb_ctx
);
#endif
/* TARANTOOL_FIBER_H_INCLUDED */
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