Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
c1f41337
Commit
c1f41337
authored
Jan 04, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
maintenance
parent
c05a8c82
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
20 deletions
+11
-20
cppa/abstract_actor.hpp
cppa/abstract_actor.hpp
+2
-1
cppa/detail/yield_interface.hpp
cppa/detail/yield_interface.hpp
+2
-7
src/yield_interface.cpp
src/yield_interface.cpp
+2
-6
src/yielding_actor.cpp
src/yielding_actor.cpp
+1
-3
unit_testing/test__yield_interface.cpp
unit_testing/test__yield_interface.cpp
+4
-3
No files found.
cppa/abstract_actor.hpp
View file @
c1f41337
...
@@ -176,7 +176,8 @@ class abstract_actor : public Base
...
@@ -176,7 +176,8 @@ class abstract_actor : public Base
guard_type
guard
(
m_mtx
);
guard_type
guard
(
m_mtx
);
if
(
exited
())
if
(
exited
())
{
{
other
->
enqueue
(
this
,
atom
(
":Exit"
),
m_exit_reason
.
load
());
other
->
enqueue
(
this
,
make_tuple
(
atom
(
":Exit"
),
m_exit_reason
.
load
()));
}
}
else
if
(
other
->
establish_backlink
(
this
))
else
if
(
other
->
establish_backlink
(
this
))
{
{
...
...
cppa/detail/yield_interface.hpp
View file @
c1f41337
...
@@ -44,19 +44,14 @@ enum class yield_state
...
@@ -44,19 +44,14 @@ enum class yield_state
// actor waits for messages
// actor waits for messages
blocked
,
blocked
,
// actor finished execution
// actor finished execution
done
,
done
// actor was killed because of an unhandled exception
killed
};
};
// return to the scheduler / worker
// return to the scheduler / worker
void
yield
(
yield_state
);
void
yield
(
yield_state
);
// returns the yielded state of a scheduled actor
yield_state
yielded_state
();
// switches to @p what and returns to @p from after yield(...)
// switches to @p what and returns to @p from after yield(...)
void
call
(
util
::
fiber
*
what
,
util
::
fiber
*
from
);
yield_state
call
(
util
::
fiber
*
what
,
util
::
fiber
*
from
);
}
}
// namespace cppa::detail
}
}
// namespace cppa::detail
...
...
src/yield_interface.cpp
View file @
c1f41337
...
@@ -50,17 +50,13 @@ void yield(yield_state ystate)
...
@@ -50,17 +50,13 @@ void yield(yield_state ystate)
util
::
fiber
::
swap
(
*
t_callee
,
*
t_caller
);
util
::
fiber
::
swap
(
*
t_callee
,
*
t_caller
);
}
}
yield_state
yielded_state
()
yield_state
call
(
util
::
fiber
*
what
,
util
::
fiber
*
from
)
{
return
t_ystate
;
}
void
call
(
util
::
fiber
*
what
,
util
::
fiber
*
from
)
{
{
t_ystate
=
yield_state
::
invalid
;
t_ystate
=
yield_state
::
invalid
;
t_caller
=
from
;
t_caller
=
from
;
t_callee
=
what
;
t_callee
=
what
;
util
::
fiber
::
swap
(
*
from
,
*
what
);
util
::
fiber
::
swap
(
*
from
,
*
what
);
return
t_ystate
;
}
}
}
}
// namespace cppa::detail
}
}
// namespace cppa::detail
src/yielding_actor.cpp
View file @
c1f41337
...
@@ -136,11 +136,9 @@ void yielding_actor::resume(util::fiber* from, resume_callback* callback)
...
@@ -136,11 +136,9 @@ void yielding_actor::resume(util::fiber* from, resume_callback* callback)
//set_self(this);
//set_self(this);
for
(;;)
for
(;;)
{
{
call
(
&
m_fiber
,
from
);
switch
(
call
(
&
m_fiber
,
from
))
switch
(
yielded_state
())
{
{
case
yield_state
:
:
done
:
case
yield_state
:
:
done
:
case
yield_state
:
:
killed
:
{
{
callback
->
exec_done
();
callback
->
exec_done
();
return
;
return
;
...
...
unit_testing/test__yield_interface.cpp
View file @
c1f41337
...
@@ -61,17 +61,18 @@ size_t test__yield_interface()
...
@@ -61,17 +61,18 @@ size_t test__yield_interface()
fiber
fself
;
fiber
fself
;
fiber
fcoroutine
(
coroutine
,
&
worker
);
fiber
fcoroutine
(
coroutine
,
&
worker
);
yield_state
ys
;
int
i
=
0
;
int
i
=
0
;
do
do
{
{
if
(
i
==
2
)
worker
.
m_blocked
=
false
;
if
(
i
==
2
)
worker
.
m_blocked
=
false
;
call
(
&
fcoroutine
,
&
fself
);
ys
=
call
(
&
fcoroutine
,
&
fself
);
++
i
;
++
i
;
}
}
while
(
y
ielded_state
()
!=
yield_state
::
done
&&
i
<
12
);
while
(
y
s
!=
yield_state
::
done
&&
i
<
12
);
CPPA_CHECK_EQUAL
(
y
ielded_state
()
,
yield_state
::
done
);
CPPA_CHECK_EQUAL
(
y
s
,
yield_state
::
done
);
CPPA_CHECK_EQUAL
(
worker
.
m_count
,
10
);
CPPA_CHECK_EQUAL
(
worker
.
m_count
,
10
);
CPPA_CHECK_EQUAL
(
i
,
12
);
CPPA_CHECK_EQUAL
(
i
,
12
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment