Commit a759f53b authored by neverlord's avatar neverlord

documentation

parent b14acf3b
...@@ -19,7 +19,7 @@ libcppa_la_SOURCES = \ ...@@ -19,7 +19,7 @@ libcppa_la_SOURCES = \
src/binary_serializer.cpp \ src/binary_serializer.cpp \
src/blocking_message_queue.cpp \ src/blocking_message_queue.cpp \
src/channel.cpp \ src/channel.cpp \
src/context.cpp \ src/local_actor.cpp \
src/converted_thread_context.cpp \ src/converted_thread_context.cpp \
src/cppa.cpp \ src/cppa.cpp \
src/delegate.cpp \ src/delegate.cpp \
...@@ -81,7 +81,7 @@ nobase_library_include_HEADERS = \ ...@@ -81,7 +81,7 @@ nobase_library_include_HEADERS = \
cppa/binary_serializer.hpp \ cppa/binary_serializer.hpp \
cppa/channel.hpp \ cppa/channel.hpp \
cppa/config.hpp \ cppa/config.hpp \
cppa/context.hpp \ cppa/local_actor.hpp \
cppa/cow_ptr.hpp \ cppa/cow_ptr.hpp \
cppa/cppa.hpp \ cppa/cppa.hpp \
cppa/deserializer.hpp \ cppa/deserializer.hpp \
......
#include <utility>
#include <iostream>
#include "cppa/cppa.hpp"
using std::cout;
using std::endl;
using namespace cppa;
struct foo
{
int a;
int b;
};
bool operator==(const foo& lhs, const foo& rhs)
{
return lhs.a == rhs.a
&& lhs.b == rhs.b;
}
typedef std::pair<int,int> foo_pair;
int main(int, char**)
{
announce<foo>(&foo::a, &foo::b);
announce<foo_pair>(&foo_pair::first,
&foo_pair::second);
send(self(), foo{1,2});
send(self(), foo_pair{3,4});
send(self(), atom("done"));
receive_loop
(
on<atom("done")>() >> []()
{
exit(0);
},
on<foo_pair>() >> [](const foo_pair& val)
{
cout << "foo_pair("
<< val.first << ","
<< val.second << ")"
<< endl;
},
on<foo>() >> [](const foo& val)
{
cout << "foo("
<< val.a << ","
<< val.b << ")"
<< endl;
}
);
return 0;
}
#include <utility>
#include <iostream>
#include "cppa/cppa.hpp"
using std::cout;
using std::endl;
using std::make_pair;
using namespace cppa;
class foo
{
int m_a;
int m_b;
public:
foo() : m_a(0), m_b(0) { }
foo(int a0, int b0) : m_a(a0), m_b(b0) { }
foo(const foo&) = default;
foo& operator=(const foo&) = default;
int a() const { return m_a; }
void set_a(int val) { m_a = val; }
int b() const { return m_b; }
void set_b(int val) { m_b = val; }
};
bool operator==(const foo& lhs, const foo& rhs)
{
return lhs.a() == rhs.a()
&& lhs.b() == rhs.b();
}
int main(int, char**)
{
announce<foo>(make_pair(&foo::a, &foo::set_a),
make_pair(&foo::b, &foo::set_b));
send(self(), foo{1,2});
receive
(
on<foo>() >> [](const foo& val)
{
cout << "foo("
<< val.a() << ","
<< val.b() << ")"
<< endl;
}
);
return 0;
}
#include <utility>
#include <iostream>
#include "cppa/cppa.hpp"
using std::cout;
using std::endl;
using std::make_pair;
using namespace cppa;
class foo
{
int m_a;
int m_b;
public:
foo() : m_a(0), m_b(0) { }
foo(int a0, int b0) : m_a(a0), m_b(b0) { }
foo(const foo&) = default;
foo& operator=(const foo&) = default;
int a() const { return m_a; }
void a(int val) { m_a = val; }
int b() const { return m_b; }
void b(int val) { m_b = val; }
};
bool operator==(const foo& lhs, const foo& rhs)
{
return lhs.a() == rhs.a()
&& lhs.b() == rhs.b();
}
typedef int (foo::*foo_getter)() const;
typedef void (foo::*foo_setter)(int);
int main(int, char**)
{
foo_getter g1 = &foo::a;
foo_setter s1 = &foo::a;
foo_getter g2 = &foo::b;
foo_setter s2 = &foo::b;
announce<foo>(make_pair(g1, s1),
make_pair(g2, s2));
send(self(), foo{1,2});
receive
(
on<foo>() >> [](const foo& val)
{
cout << "foo("
<< val.a() << ","
<< val.b() << ")"
<< endl;
}
);
return 0;
}
#include <utility>
#include <iostream>
#include "cppa/cppa.hpp"
using std::cout;
using std::endl;
using std::make_pair;
using namespace cppa;
class foo
{
int m_a;
int m_b;
public:
foo() : m_a(0), m_b(0) { }
foo(int a0, int b0) : m_a(a0), m_b(b0) { }
foo(const foo&) = default;
foo& operator=(const foo&) = default;
int a() const { return m_a; }
void set_a(int val) { m_a = val; }
int b() const { return m_b; }
void set_b(int val) { m_b = val; }
};
bool operator==(const foo& lhs, const foo& rhs)
{
return lhs.a() == rhs.a()
&& lhs.b() == rhs.b();
}
struct bar
{
foo f;
int i;
};
bool operator==(const bar& lhs, const bar& rhs)
{
return lhs.f == rhs.f
&& lhs.i == rhs.i;
}
int main(int, char**)
{
announce<bar>(compound_member(&bar::f,
make_pair(&foo::a, &foo::set_a),
make_pair(&foo::b, &foo::set_b)),
&bar::i);
send(self(), bar{foo{1,2},3});
receive
(
on<bar>() >> [](const bar& val)
{
cout << "bar(foo("
<< val.f.a() << ","
<< val.f.b() << "),"
<< val.i << ")"
<< endl;
}
);
return 0;
}
...@@ -72,7 +72,7 @@ unit_testing/hash_of.hpp ...@@ -72,7 +72,7 @@ unit_testing/hash_of.hpp
cppa/detail/channel.hpp cppa/detail/channel.hpp
cppa/util/first_n.hpp cppa/util/first_n.hpp
cppa/util/eval_first_n.hpp cppa/util/eval_first_n.hpp
cppa/context.hpp cppa/local_actor.hpp
cppa/channel.hpp cppa/channel.hpp
src/channel.cpp src/channel.cpp
cppa/actor_behavior.hpp cppa/actor_behavior.hpp
...@@ -91,7 +91,7 @@ queue_performances/blocking_cached_stack2.hpp ...@@ -91,7 +91,7 @@ queue_performances/blocking_cached_stack2.hpp
queue_performances/blocking_sutter_list.hpp queue_performances/blocking_sutter_list.hpp
queue_performances/lockfree_list.hpp queue_performances/lockfree_list.hpp
queue_performances/intrusive_sutter_list.hpp queue_performances/intrusive_sutter_list.hpp
src/context.cpp src/local_actor.cpp
cppa/scheduler.hpp cppa/scheduler.hpp
cppa/detail/mock_scheduler.hpp cppa/detail/mock_scheduler.hpp
src/scheduler.cpp src/scheduler.cpp
......
...@@ -19,7 +19,7 @@ class serializer; ...@@ -19,7 +19,7 @@ class serializer;
class deserializer; class deserializer;
/** /**
* @brief The base class for all actor implementations. * @brief Base class for all actor implementations.
*/ */
class actor : public channel class actor : public channel
{ {
...@@ -46,8 +46,8 @@ class actor : public channel ...@@ -46,8 +46,8 @@ class actor : public channel
* The actor will call <tt>ptr->detach(...)</tt> on exit or immediately * The actor will call <tt>ptr->detach(...)</tt> on exit or immediately
* if he already exited. * if he already exited.
* *
* @return @c true if @p ptr was successfully attached to the actor; * @returns @c true if @p ptr was successfully attached to the actor;
* otherwise (actor already exited) @p false. * otherwise (actor already exited) @p false.
*/ */
virtual bool attach(attachable* ptr) = 0; virtual bool attach(attachable* ptr) = 0;
...@@ -56,8 +56,8 @@ class actor : public channel ...@@ -56,8 +56,8 @@ class actor : public channel
* *
* The actor executes <tt>ftor()</tt> on exit or immediatley if he * The actor executes <tt>ftor()</tt> on exit or immediatley if he
* already exited. * already exited.
* @return @c true if @p ftor was successfully attached to the actor; * @returns @c true if @p ftor was successfully attached to the actor;
* otherwise (actor already exited) @p false. * otherwise (actor already exited) @p false.
*/ */
template<typename F> template<typename F>
bool attach_functor(F&& ftor); bool attach_functor(F&& ftor);
...@@ -95,15 +95,15 @@ class actor : public channel ...@@ -95,15 +95,15 @@ class actor : public channel
/** /**
* @brief Establishes a link relation between this actor and @p other. * @brief Establishes a link relation between this actor and @p other.
* @return @c true if this actor is running and added @p other to its * @returns @c true if this actor is running and added @p other to its
* list of linked actors. * list of linked actors.
*/ */
virtual bool establish_backlink(intrusive_ptr<actor>& other) = 0; virtual bool establish_backlink(intrusive_ptr<actor>& other) = 0;
/** /**
* @brief Removes a link relation between this actor and @p other. * @brief Removes a link relation between this actor and @p other.
* @return @c true if this actor is running and removed @p other * @returns @c true if this actor is running and removed @p other
* from its list of linked actors. * from its list of linked actors.
*/ */
virtual bool remove_backlink(intrusive_ptr<actor>& other) = 0; virtual bool remove_backlink(intrusive_ptr<actor>& other) = 0;
...@@ -115,28 +115,28 @@ class actor : public channel ...@@ -115,28 +115,28 @@ class actor : public channel
/** /**
* @brief Gets the {@link process_information} of the parent process. * @brief Gets the {@link process_information} of the parent process.
* @return The {@link process_information} of the parent process. * @returns The {@link process_information} of the parent process.
*/ */
inline const process_information& parent_process() const; inline const process_information& parent_process() const;
/** /**
* @brief Gets the {@link process_information} pointer * @brief Gets the {@link process_information} pointer
* of the parent process. * of the parent process.
* @return A pointer to the {@link process_information} * @returns A pointer to the {@link process_information}
* of the parent process. * of the parent process.
*/ */
inline process_information_ptr parent_process_ptr() const; inline process_information_ptr parent_process_ptr() const;
/** /**
* @brief Get the unique identifier of this actor. * @brief Get the unique identifier of this actor.
* @return The unique identifier of this actor. * @returns The unique identifier of this actor.
*/ */
inline std::uint32_t id() const; inline std::uint32_t id() const;
/** /**
* @brief Get the actor that has the unique identifier @p actor_id. * @brief Get the actor that has the unique identifier @p actor_id.
* @return A pointer to the requestet actor or @c nullptr if no * @returns A pointer to the requestet actor or @c nullptr if no
* running actor with the ID @p actor_id was found. * running actor with the ID @p actor_id was found.
*/ */
static intrusive_ptr<actor> by_id(std::uint32_t actor_id); static intrusive_ptr<actor> by_id(std::uint32_t actor_id);
......
...@@ -18,7 +18,7 @@ namespace cppa { ...@@ -18,7 +18,7 @@ namespace cppa {
* foo(1,2)<br> * foo(1,2)<br>
* foo_pair(3,4) * foo_pair(3,4)
* </tt> * </tt>
* @example announce_example_1 * @example announce_example_1.cpp
*/ */
/** /**
...@@ -27,7 +27,7 @@ namespace cppa { ...@@ -27,7 +27,7 @@ namespace cppa {
* The output of this example program is: * The output of this example program is:
* *
* <tt>foo(1,2)</tt> * <tt>foo(1,2)</tt>
* @example announce_example_2 * @example announce_example_2.cpp
*/ */
/** /**
...@@ -37,7 +37,7 @@ namespace cppa { ...@@ -37,7 +37,7 @@ namespace cppa {
* The output of this example program is: * The output of this example program is:
* *
* <tt>foo(1,2)</tt> * <tt>foo(1,2)</tt>
* @example announce_example_3 * @example announce_example_3.cpp
*/ */
/** /**
...@@ -46,19 +46,25 @@ namespace cppa { ...@@ -46,19 +46,25 @@ namespace cppa {
* The output of this example program is: * The output of this example program is:
* *
* <tt>bar(foo(1,2),3)</tt> * <tt>bar(foo(1,2),3)</tt>
* @example announce_example_4 * @example announce_example_4.cpp
*/ */
/** /**
* @brief Adds a new type mapping to the type system. * @brief Adds a new type mapping to the libcppa type system.
* @return @c true if @p uniform_type was added as known * @param tinfo C++ RTTI for the new type
* @param utype Corresponding {@link uniform_type_info} instance.
* @returns @c true if @p uniform_type was added as known
* instance (mapped to @p plain_type); otherwise @c false * instance (mapped to @p plain_type); otherwise @c false
* is returned and @p uniform_type was deleted. * is returned and @p uniform_type was deleted.
*/ */
bool announce(const std::type_info& tinfo, uniform_type_info* utype); bool announce(const std::type_info& tinfo, uniform_type_info* utype);
/** /**
* * @brief Creates meta informations for a non-trivial member.
* @param c_ptr Pointer to the non-trivial member.
* @param args "Sub-members" of @p c_ptr
* @see {@link announce_example_4.cpp announce example 4}
* @returns A pair of @p c_ptr and the created meta informations.
*/ */
template<class C, class Parent, typename... Args> template<class C, class Parent, typename... Args>
std::pair<C Parent::*, util::abstract_uniform_type_info<C>*> std::pair<C Parent::*, util::abstract_uniform_type_info<C>*>
...@@ -68,7 +74,10 @@ compound_member(C Parent::*c_ptr, const Args&... args) ...@@ -68,7 +74,10 @@ compound_member(C Parent::*c_ptr, const Args&... args)
} }
/** /**
* @brief Adds a mapping for @p T to the type system. * @brief Adds a new type mapping for @p T to the libcppa type system.
* @param args Members of @p T.
* @returns @c true if @p T was added to the libcppa type system;
* otherwise @c false.
*/ */
template<typename T, typename... Args> template<typename T, typename... Args>
inline bool announce(const Args&... args) inline bool announce(const Args&... args)
......
...@@ -12,10 +12,10 @@ class group; ...@@ -12,10 +12,10 @@ class group;
class message; class message;
/** /**
* @brief The base interface for all message receivers. * @brief Interface for all message receivers.
* *
* This interface is implemented by {@link actor} and {@link group} and * This interface describes an entity that can receive messages
* describes an entity that can receive messages. * and is implemented by {@link actor} and {@link group}.
*/ */
class channel : public ref_counted class channel : public ref_counted
{ {
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include "cppa/actor.hpp" #include "cppa/actor.hpp"
#include "cppa/invoke.hpp" #include "cppa/invoke.hpp"
#include "cppa/channel.hpp" #include "cppa/channel.hpp"
#include "cppa/context.hpp" #include "cppa/local_actor.hpp"
#include "cppa/message.hpp" #include "cppa/message.hpp"
#include "cppa/announce.hpp" #include "cppa/announce.hpp"
#include "cppa/scheduler.hpp" #include "cppa/scheduler.hpp"
...@@ -57,8 +57,35 @@ ...@@ -57,8 +57,35 @@
#include "cppa/detail/receive_loop_helper.hpp" #include "cppa/detail/receive_loop_helper.hpp"
/** /**
* @brief The root namespace of libcppa. * @author Dominik Charousset <dominik.charousset\@haw-hamburg.de>
*
* @mainpage libcppa
*
* @section Intro Introduction
*
* This library provides an implementation of the Actor model for C++.
*
* @section GettingStarted Getting started with libcppa
*
* @namespace cppa
* @brief This is the root namespace of libcppa.
*
* Thie @b cppa namespace contains all functions and classes to
* implement Actor based applications.
*
* @namespace cppa::util
* @brief This namespace contains utility classes and meta programming
* utilities used by the libcppa implementation.
*
* @defgroup ReceiveMessages Receive messages
* @brief
*
* @section UsingOwnTypes Using own types in messages
* @brief
*
*/ */
namespace cppa { namespace cppa {
/** /**
...@@ -95,12 +122,13 @@ void monitor(actor_ptr&& whom); ...@@ -95,12 +122,13 @@ void monitor(actor_ptr&& whom);
/** /**
* @brief Removes a monitor from @p whom. * @brief Removes a monitor from @p whom.
* @param whom Monitored Actor.
*/ */
void demonitor(actor_ptr& whom); void demonitor(actor_ptr& whom);
/** /**
* @brief * @brief
* @return * @returns
*/ */
inline bool trap_exit() inline bool trap_exit()
{ {
...@@ -137,7 +165,9 @@ actor_ptr spawn(F&& what, const Args&... args) ...@@ -137,7 +165,9 @@ actor_ptr spawn(F&& what, const Args&... args)
} }
/** /**
* @brief Quits execution of the calling actor. * @copydoc context::quit(std::uint32_t)
*
* Alias for <tt>self()->quit(reason);</tt>
*/ */
inline void quit(std::uint32_t reason) inline void quit(std::uint32_t reason)
{ {
...@@ -200,8 +230,6 @@ receive_while(Statement&& stmt) ...@@ -200,8 +230,6 @@ receive_while(Statement&& stmt)
return std::move(stmt); return std::move(stmt);
} }
/** /**
* @brief Receives messages until @p stmt returns true. * @brief Receives messages until @p stmt returns true.
* *
...@@ -209,6 +237,7 @@ receive_while(Statement&& stmt) ...@@ -209,6 +237,7 @@ receive_while(Statement&& stmt)
* @code * @code
* do { receive(...); } while (stmt() == false); * do { receive(...); } while (stmt() == false);
* @endcode * @endcode
* @param args
*/ */
template<typename... Args> template<typename... Args>
detail::do_receive_helper do_receive(Args&&... args) detail::do_receive_helper do_receive(Args&&... args)
...@@ -216,11 +245,9 @@ detail::do_receive_helper do_receive(Args&&... args) ...@@ -216,11 +245,9 @@ detail::do_receive_helper do_receive(Args&&... args)
return detail::do_receive_helper(std::forward<Args>(args)...); return detail::do_receive_helper(std::forward<Args>(args)...);
} }
/** /**
* @brief Gets the last dequeued message from the mailbox. * @brief Gets the last dequeued message from the mailbox.
* @return The last dequeued message from the mailbox. * @returns The last dequeued message from the mailbox.
*/ */
inline const message& last_received() inline const message& last_received()
{ {
...@@ -244,7 +271,7 @@ send(intrusive_ptr<C>&& whom, const Arg0& arg0, const Args&... args) ...@@ -244,7 +271,7 @@ send(intrusive_ptr<C>&& whom, const Arg0& arg0, const Args&... args)
// 'matches' send(self(), ...); // 'matches' send(self(), ...);
template<typename Arg0, typename... Args> template<typename Arg0, typename... Args>
void send(context* whom, const Arg0& arg0, const Args&... args) void send(local_actor* whom, const Arg0& arg0, const Args&... args)
{ {
if (whom) whom->enqueue(message(self(), whom, arg0, args...)); if (whom) whom->enqueue(message(self(), whom, arg0, args...));
} }
...@@ -284,15 +311,15 @@ operator<<(intrusive_ptr<C>&& whom, any_tuple&& what) ...@@ -284,15 +311,15 @@ operator<<(intrusive_ptr<C>&& whom, any_tuple&& what)
} }
// matches self() << make_tuple(...) // matches self() << make_tuple(...)
context* operator<<(context* whom, const any_tuple& what); local_actor* operator<<(local_actor* whom, const any_tuple& what);
// matches self() << make_tuple(...) // matches self() << make_tuple(...)
context* operator<<(context* whom, any_tuple&& what); local_actor* operator<<(local_actor* whom, any_tuple&& what);
template<typename Arg0, typename... Args> template<typename Arg0, typename... Args>
void reply(const Arg0& arg0, const Args&... args) void reply(const Arg0& arg0, const Args&... args)
{ {
context* sptr = self(); local_actor* sptr = self();
actor_ptr whom = sptr->mailbox().last_dequeued().sender(); actor_ptr whom = sptr->mailbox().last_dequeued().sender();
if (whom) whom->enqueue(message(sptr, whom, arg0, args...)); if (whom) whom->enqueue(message(sptr, whom, arg0, args...));
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "cppa/atom.hpp" #include "cppa/atom.hpp"
#include "cppa/actor.hpp" #include "cppa/actor.hpp"
#include "cppa/context.hpp" #include "cppa/local_actor.hpp"
#include "cppa/attachable.hpp" #include "cppa/attachable.hpp"
#include "cppa/exit_reason.hpp" #include "cppa/exit_reason.hpp"
......
...@@ -11,17 +11,17 @@ ...@@ -11,17 +11,17 @@
#include <memory> #include <memory>
#include <cstdint> #include <cstdint>
#include "cppa/context.hpp" #include "cppa/local_actor.hpp"
#include "cppa/exit_reason.hpp" #include "cppa/exit_reason.hpp"
#include "cppa/detail/abstract_actor.hpp" #include "cppa/detail/abstract_actor.hpp"
#include "cppa/detail/blocking_message_queue.hpp" #include "cppa/detail/blocking_message_queue.hpp"
namespace cppa { namespace detail { namespace cppa { namespace detail {
class converted_thread_context : public abstract_actor<context> class converted_thread_context : public abstract_actor<local_actor>
{ {
typedef abstract_actor<context> super; typedef abstract_actor<local_actor> super;
public: public:
......
#ifndef SCHEDULED_ACTOR_HPP #ifndef SCHEDULED_ACTOR_HPP
#define SCHEDULED_ACTOR_HPP #define SCHEDULED_ACTOR_HPP
#include "cppa/context.hpp" #include "cppa/local_actor.hpp"
#include "cppa/util/fiber.hpp" #include "cppa/util/fiber.hpp"
#include "cppa/actor_behavior.hpp" #include "cppa/actor_behavior.hpp"
#include "cppa/util/single_reader_queue.hpp" #include "cppa/util/single_reader_queue.hpp"
...@@ -14,10 +14,10 @@ namespace cppa { namespace detail { ...@@ -14,10 +14,10 @@ namespace cppa { namespace detail {
class task_scheduler; class task_scheduler;
class scheduled_actor : public abstract_actor<context> class scheduled_actor : public abstract_actor<local_actor>
{ {
typedef abstract_actor<context> super; typedef abstract_actor<local_actor> super;
friend class task_scheduler; friend class task_scheduler;
friend class util::single_reader_queue<scheduled_actor>; friend class util::single_reader_queue<scheduled_actor>;
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
namespace cppa { namespace cppa {
/**
* @brief Base class for libcppa exceptions.
*/
class exception : public std::exception class exception : public std::exception
{ {
...@@ -14,16 +17,33 @@ class exception : public std::exception ...@@ -14,16 +17,33 @@ class exception : public std::exception
protected: protected:
/**
* @brief Creates an exception with the error string @p what_str.
* @param what_str Error message as rvalue string.
*/
exception(std::string&& what_str); exception(std::string&& what_str);
/**
* @brief Creates an exception with the error string @p what_str.
* @param what_str Error message as string.
*/
exception(const std::string& what_str); exception(const std::string& what_str);
public: public:
~exception() throw(); ~exception() throw();
/**
* @brief Returns the error message.
* @returns The error message as C-string.
*/
const char* what() const throw(); const char* what() const throw();
}; };
/**
* @brief Thrown if an Actor finished execution.
*/
class actor_exited : public exception class actor_exited : public exception
{ {
...@@ -32,6 +52,10 @@ class actor_exited : public exception ...@@ -32,6 +52,10 @@ class actor_exited : public exception
public: public:
actor_exited(std::uint32_t exit_reason); actor_exited(std::uint32_t exit_reason);
/**
*
*/
inline std::uint32_t reason() const throw(); inline std::uint32_t reason() const throw();
}; };
......
...@@ -77,7 +77,7 @@ class group : public channel ...@@ -77,7 +77,7 @@ class group : public channel
/** /**
* @brief Get the name of this module implementation. * @brief Get the name of this module implementation.
* @return The name of this module implementation. * @returnss The name of this module implementation.
* @threadsafe * @threadsafe
*/ */
const std::string& name(); const std::string& name();
...@@ -93,20 +93,20 @@ class group : public channel ...@@ -93,20 +93,20 @@ class group : public channel
/** /**
* @brief A string representation of the group identifier. * @brief A string representation of the group identifier.
* @return The group identifier as string (e.g. "224.0.0.1" for IPv4 * @returnss The group identifier as string (e.g. "224.0.0.1" for IPv4
* multicast or a user-defined string for local groups). * multicast or a user-defined string for local groups).
*/ */
const std::string& identifier() const; const std::string& identifier() const;
/** /**
* @brief The name of the module. * @brief The name of the module.
* @return The module name of this group (e.g. "local"). * @returnss The module name of this group (e.g. "local").
*/ */
const std::string& module_name() const; const std::string& module_name() const;
/** /**
* @brief Subscribe @p who to this group. * @brief Subscribe @p who to this group.
* @return A {@link subscription} object that unsubscribes @p who * @returnss A {@link subscription} object that unsubscribes @p who
* if the lifetime of @p who ends. * if the lifetime of @p who ends.
*/ */
virtual subscription subscribe(const channel_ptr& who) = 0; virtual subscription subscribe(const channel_ptr& who) = 0;
......
...@@ -49,12 +49,27 @@ namespace cppa { ...@@ -49,12 +49,27 @@ namespace cppa {
class any_tuple; class any_tuple;
class invoke_rules; class invoke_rules;
class timed_invoke_rules;
typedef std::list<detail::invokable_ptr> invokable_list; typedef std::list<detail::invokable_ptr> invokable_list;
/**
* @brief Base of {@link timed_invoke_rules} and {@link invoke_rules}.
*/
class invoke_rules_base class invoke_rules_base
{ {
friend class invoke_rules;
friend class timed_invoke_rules;
private:
invoke_rules_base() = default;
invoke_rules_base(invokable_list&& ilist);
invoke_rules_base(invoke_rules_base&& other);
protected: protected:
invokable_list m_list; invokable_list m_list;
...@@ -69,12 +84,29 @@ class invoke_rules_base ...@@ -69,12 +84,29 @@ class invoke_rules_base
virtual ~invoke_rules_base(); virtual ~invoke_rules_base();
bool operator()(const any_tuple& t) const; /**
* @brief Tries to match @p data with one of the stored patterns.
detail::intermediate* get_intermediate(const any_tuple& t) const; *
* If a pattern matched @p data, the corresponding callback is invoked.
* @param data Data tuple that should be matched.
* @returns @p true if a pattern matched @p data;
* otherwise @p false.
*/
bool operator()(const any_tuple& data) const;
/**
* @brief Tries to match @p data with one of the stored patterns.
* @param data Data tuple that should be matched.
* @returns An {@link intermediate} instance that could invoke
* the corresponding callback; otherwise @p nullptr.
*/
detail::intermediate* get_intermediate(const any_tuple& data) const;
}; };
/**
* @brief Invoke rules with timeout.
*/
class timed_invoke_rules : public invoke_rules_base class timed_invoke_rules : public invoke_rules_base
{ {
...@@ -104,6 +136,9 @@ public: ...@@ -104,6 +136,9 @@ public:
}; };
/**
* @brief Invoke rules without timeout.
*/
class invoke_rules : public invoke_rules_base class invoke_rules : public invoke_rules_base
{ {
......
...@@ -9,9 +9,9 @@ namespace cppa { ...@@ -9,9 +9,9 @@ namespace cppa {
class scheduler; class scheduler;
/** /**
* * @brief Base class for local running Actors.
*/ */
class context : public actor class local_actor : public actor
{ {
friend class scheduler; friend class scheduler;
...@@ -19,8 +19,12 @@ class context : public actor ...@@ -19,8 +19,12 @@ class context : public actor
public: public:
/** /**
* @brief Cause this context to send an exit signal to all of its linked * @brief Finishes execution of this actor.
* linked actors and set its state to @c exited. *
* Cause this actor to send an exit signal to all of its
* linked actors, sets its state to @c exited and throws
* {@link actor_exited} to cleanup the stack.
* @throws actor_exited
*/ */
virtual void quit(std::uint32_t reason) = 0; virtual void quit(std::uint32_t reason) = 0;
...@@ -45,12 +49,12 @@ class context : public actor ...@@ -45,12 +49,12 @@ class context : public actor
}; };
inline bool context::trap_exit() const inline bool local_actor::trap_exit() const
{ {
return mailbox().trap_exit(); return mailbox().trap_exit();
} }
inline void context::trap_exit(bool new_value) inline void local_actor::trap_exit(bool new_value)
{ {
mailbox().trap_exit(new_value); mailbox().trap_exit(new_value);
} }
...@@ -58,13 +62,13 @@ inline void context::trap_exit(bool new_value) ...@@ -58,13 +62,13 @@ inline void context::trap_exit(bool new_value)
/** /**
* @brief Get a pointer to the current active context. * @brief Get a pointer to the current active context.
*/ */
context* self(); local_actor* self();
// "private" function // "private" function
void set_self(context*); void set_self(local_actor*);
// "private" function, returns active context (without creating it if needed) // "private" function, returns active context (without creating it if needed)
context* unchecked_self(); local_actor* unchecked_self();
} // namespace cppa } // namespace cppa
......
...@@ -10,6 +10,9 @@ namespace cppa { ...@@ -10,6 +10,9 @@ namespace cppa {
class invoke_rules; class invoke_rules;
class timed_invoke_rules; class timed_invoke_rules;
/**
* @brief A message queue with many-writers-single-reader semantics.
*/
class message_queue : public ref_counted class message_queue : public ref_counted
{ {
...@@ -20,22 +23,77 @@ class message_queue : public ref_counted ...@@ -20,22 +23,77 @@ class message_queue : public ref_counted
public: public:
/**
* @brief Creates an instance with <tt>{@link trap_exit()} == false</tt>.
*/
message_queue(); message_queue();
virtual void enqueue(const message&) = 0; /**
* @brief Enqueues a new element to the message queue.
* @param msg The new message.
*/
virtual void enqueue(const message& msg) = 0;
/**
* @brief Dequeues the oldest message (FIFO order) from the message queue.
* @returns The oldest message from the queue.
* @warning Call only from the owner of the queue.
*/
virtual const message& dequeue() = 0; virtual const message& dequeue() = 0;
virtual void dequeue(invoke_rules&) = 0;
virtual void dequeue(timed_invoke_rules&) = 0;
/**
* @brief Removes the first element from the queue that is matched
* by @p rules and invokes the corresponding callback.
* @param rules
* @warning Call only from the owner of the queue.
*/
virtual void dequeue(invoke_rules& rules) = 0;
/**
* @brief
* @param rules
* @warning Call only from the owner of the queue.
*/
virtual void dequeue(timed_invoke_rules& rules) = 0;
/**
*
* @warning Call only from the owner of the queue.
*/
virtual bool try_dequeue(message&) = 0; virtual bool try_dequeue(message&) = 0;
/**
*
* @warning Call only from the owner of the queue.
*/
virtual bool try_dequeue(invoke_rules&) = 0; virtual bool try_dequeue(invoke_rules&) = 0;
/**
*
* @warning Call only from the owner of the queue.
*/
inline bool trap_exit() const; inline bool trap_exit() const;
/**
*
* @warning Call only from the owner of the queue.
*/
inline void trap_exit(bool value); inline void trap_exit(bool value);
/**
* @brief Gets the last dequeued message.
* @returns The last message object that was removed from the queue
* by a dequeue() or try_dequeue() member function call.
* @warning Call only from the owner of the queue.
*/
inline const message& last_dequeued() const; inline const message& last_dequeued() const;
}; };
/******************************************************************************
* inline and template member function implementations *
******************************************************************************/
inline bool message_queue::trap_exit() const inline bool message_queue::trap_exit() const
{ {
return m_trap_exit; return m_trap_exit;
......
...@@ -16,8 +16,10 @@ class uniform_type_info; ...@@ -16,8 +16,10 @@ class uniform_type_info;
const uniform_type_info* uniform_typeid(const std::type_info&); const uniform_type_info* uniform_typeid(const std::type_info&);
namespace detail { template<typename T> struct object_caster; } namespace detail { template<typename T> struct object_caster; }
bool operator==(const uniform_type_info& lhs, const std::type_info& rhs); bool operator==(const uniform_type_info& lhs, const std::type_info& rhs);
/** /**
* @brief foobar. * @brief A wrapper around a void pointer that stores type informations
* and provides copy, move and comparsion operations.
*/ */
class object class object
{ {
...@@ -32,6 +34,10 @@ class object ...@@ -32,6 +34,10 @@ class object
void swap(object& other); void swap(object& other);
/*
* @brief Copies this object.
* @returns A (deep) copy of this object.
*/
object copy() const; object copy() const;
static void* new_instance(const uniform_type_info* type, static void* new_instance(const uniform_type_info* type,
...@@ -40,18 +46,22 @@ class object ...@@ -40,18 +46,22 @@ class object
public: public:
/** /**
* @brief Create an object of type @p utinfo with value @p val. * @brief Creates an object of type @p utinfo with value @p val.
* @warning {@link object} takes ownership of @p val. * @warning {@link object} takes ownership of @p val.
* @pre {@code val != nullptr && utinfo != nullptr} * @pre {@code val != nullptr && utinfo != nullptr}
*/ */
object(void* val, const uniform_type_info* utinfo); object(void* val, const uniform_type_info* utinfo);
/** /**
* @brief Create an empty object. * @brief Creates an empty object.
* @post {@code empty() && type() == *uniform_typeid<util::void_type>()} * @post {@code empty() && type() == *uniform_typeid<util::void_type>()}
*/ */
object(); object();
/**
* @brief Creates an object with a copy of @p what.
* @post {@code empty() == false && type() == *uniform_typeid<T>()}
*/
template<typename T> template<typename T>
explicit object(const T& what); explicit object(const T& what);
...@@ -60,7 +70,7 @@ public: ...@@ -60,7 +70,7 @@ public:
/** /**
* @brief Creates an object and moves type and value * @brief Creates an object and moves type and value
* from @p other to @c this. * from @p other to @c this.
* @post {@code other.type() == uniform_typeid<util::void_type>()} * @post {@code other.empty() == true}
*/ */
object(object&& other); object(object&& other);
...@@ -71,11 +81,15 @@ public: ...@@ -71,11 +81,15 @@ public:
object(const object& other); object(const object& other);
/** /**
* @brief Move the content from @p other to this. * @brief Moves the content from @p other to this.
* @post {@code other.type() == nullptr} * @returns @p *this
* @post {@code other.empty() == true}
*/ */
object& operator=(object&& other); object& operator=(object&& other);
/**
*
*/
object& operator=(const object& other); object& operator=(const object& other);
bool equal_to(const object& other) const; bool equal_to(const object& other) const;
......
...@@ -49,7 +49,7 @@ class process_information : public ref_counted, ...@@ -49,7 +49,7 @@ class process_information : public ref_counted,
/** /**
* @brief Returns the proccess_information for the running process. * @brief Returns the proccess_information for the running process.
* @return * @returnss
*/ */
static const intrusive_ptr<process_information>& get(); static const intrusive_ptr<process_information>& get();
......
#ifndef RECEIVE_HPP #ifndef RECEIVE_HPP
#define RECEIVE_HPP #define RECEIVE_HPP
#include "cppa/context.hpp" #include "cppa/local_actor.hpp"
namespace cppa { namespace cppa {
...@@ -56,7 +56,7 @@ void receive(invoke_rules& rules, Head&& head, Tail&&... tail) ...@@ -56,7 +56,7 @@ void receive(invoke_rules& rules, Head&& head, Tail&&... tail)
/** /**
* @brief Tries to dequeue the next message from the mailbox. * @brief Tries to dequeue the next message from the mailbox.
* @return @p true if a messages was dequeued; * @returnss @p true if a messages was dequeued;
* @p false if the mailbox is empty * @p false if the mailbox is empty
*/ */
inline bool try_receive(message& msg) inline bool try_receive(message& msg)
...@@ -66,7 +66,7 @@ inline bool try_receive(message& msg) ...@@ -66,7 +66,7 @@ inline bool try_receive(message& msg)
/** /**
* @brief Tries to dequeue the next message from the mailbox. * @brief Tries to dequeue the next message from the mailbox.
* @return @p true if a messages was dequeued; * @returnss @p true if a messages was dequeued;
* @p false if the mailbox is empty * @p false if the mailbox is empty
*/ */
inline bool try_receive(invoke_rules& rules) inline bool try_receive(invoke_rules& rules)
......
...@@ -17,11 +17,11 @@ namespace cppa { ...@@ -17,11 +17,11 @@ namespace cppa {
// forward declarations // forward declarations
class context; class local_actor;
class actor_behavior; class actor_behavior;
class scheduler_helper; class scheduler_helper;
context* self(); local_actor* self();
/** /**
* @brief * @brief
...@@ -40,7 +40,7 @@ class scheduler ...@@ -40,7 +40,7 @@ class scheduler
/** /**
* @brief Calls {@link context::exit(std::uint32_t) context::exit}. * @brief Calls {@link context::exit(std::uint32_t) context::exit}.
*/ */
void exit_context(context* ctx, std::uint32_t reason); void exit_context(local_actor* ctx, std::uint32_t reason);
public: public:
...@@ -68,12 +68,12 @@ class scheduler ...@@ -68,12 +68,12 @@ class scheduler
* (a thread that acts as actor). * (a thread that acts as actor).
* @note Calls <tt>what->attach(...)</tt>. * @note Calls <tt>what->attach(...)</tt>.
*/ */
virtual void register_converted_context(context* what); virtual void register_converted_context(local_actor* what);
/** /**
* @brief Informs the scheduler about a hidden (non-actor) * @brief Informs the scheduler about a hidden (non-actor)
* context that should be counted by await_others_done(). * context that should be counted by await_others_done().
* @return An {@link attachable} that the hidden context has to destroy * @returnss An {@link attachable} that the hidden context has to destroy
* if his lifetime ends. * if his lifetime ends.
*/ */
virtual attachable* register_hidden_context(); virtual attachable* register_hidden_context();
...@@ -104,7 +104,7 @@ void set_scheduler(scheduler* sched); ...@@ -104,7 +104,7 @@ void set_scheduler(scheduler* sched);
/** /**
* @brief Gets the actual used scheduler implementation. * @brief Gets the actual used scheduler implementation.
* @return The active scheduler (default constructed). * @returnss The active scheduler (default constructed).
*/ */
scheduler* get_scheduler(); scheduler* get_scheduler();
......
...@@ -104,13 +104,13 @@ class uniform_type_info : cppa::util::comparable<uniform_type_info> ...@@ -104,13 +104,13 @@ class uniform_type_info : cppa::util::comparable<uniform_type_info>
/** /**
* @brief Get instance by uniform name. * @brief Get instance by uniform name.
* @param uniform_name The libCPPA internal name for a type. * @param uniform_name The libCPPA internal name for a type.
* @return The instance associated to @p uniform_name. * @returnss The instance associated to @p uniform_name.
*/ */
static uniform_type_info* by_uniform_name(const std::string& uniform_name); static uniform_type_info* by_uniform_name(const std::string& uniform_name);
/** /**
* @brief Get all instances. * @brief Get all instances.
* @return A vector with all known (announced) instances. * @returnss A vector with all known (announced) instances.
*/ */
static std::vector<uniform_type_info*> instances(); static std::vector<uniform_type_info*> instances();
...@@ -118,13 +118,13 @@ class uniform_type_info : cppa::util::comparable<uniform_type_info> ...@@ -118,13 +118,13 @@ class uniform_type_info : cppa::util::comparable<uniform_type_info>
/** /**
* @brief Get the internal libCPPA name for this type. * @brief Get the internal libCPPA name for this type.
* @return A string describing the libCPPA internal type name. * @returnss A string describing the libCPPA internal type name.
*/ */
inline const std::string& name() const { return m_name; } inline const std::string& name() const { return m_name; }
/** /**
* @brief Get the unique identifier of this instance. * @brief Get the unique identifier of this instance.
* @return The unique identifier of this instance. * @returnss The unique identifier of this instance.
*/ */
inline const identifier& id() const { return m_id; } inline const identifier& id() const { return m_id; }
......
...@@ -20,7 +20,7 @@ struct abstract_type_list ...@@ -20,7 +20,7 @@ struct abstract_type_list
/** /**
* @brief Increases the iterator position. * @brief Increases the iterator position.
* @return @c false if the iterator is at the end; otherwise @c true. * @returnss @c false if the iterator is at the end; otherwise @c true.
*/ */
virtual bool next() = 0; virtual bool next() = 0;
......
...@@ -337,7 +337,7 @@ EXTRACT_ANON_NSPACES = NO ...@@ -337,7 +337,7 @@ EXTRACT_ANON_NSPACES = NO
# various overviews, but no documentation section is generated. # various overviews, but no documentation section is generated.
# This option has no effect if EXTRACT_ALL is enabled. # This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_MEMBERS = NO HIDE_UNDOC_MEMBERS = YES
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy. # undocumented classes that are normally visible in the class hierarchy.
...@@ -565,7 +565,7 @@ WARN_LOGFILE = ...@@ -565,7 +565,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories # directories like "/usr/src/myproject". Separate the files or directories
# with spaces. # with spaces.
INPUT = cppa/ cppa/util cppa/detail INPUT = cppa/ cppa/util
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
...@@ -622,7 +622,7 @@ EXCLUDE_SYMBOLS = ...@@ -622,7 +622,7 @@ EXCLUDE_SYMBOLS =
# directories that contain example code fragments that are included (see # directories that contain example code fragments that are included (see
# the \include command). # the \include command).
EXAMPLE_PATH = ./ EXAMPLE_PATH = documentation
# If the value of the EXAMPLE_PATH tag contains directories, you can use the # If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
...@@ -642,7 +642,7 @@ EXAMPLE_RECURSIVE = YES ...@@ -642,7 +642,7 @@ EXAMPLE_RECURSIVE = YES
# directories that contain image that are included in the documentation (see # directories that contain image that are included in the documentation (see
# the \image command). # the \image command).
IMAGE_PATH = ./doxygen_images IMAGE_PATH =
# The INPUT_FILTER tag can be used to specify a program that doxygen should # The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program # invoke to filter for each input file. Doxygen will invoke the filter program
...@@ -1508,4 +1508,4 @@ DOT_CLEANUP = YES ...@@ -1508,4 +1508,4 @@ DOT_CLEANUP = YES
# The SEARCHENGINE tag specifies whether or not a search engine should be # The SEARCHENGINE tag specifies whether or not a search engine should be
# used. If set to NO the values of all tags below this one will be ignored. # used. If set to NO the values of all tags below this one will be ignored.
SEARCHENGINE = YES SEARCHENGINE = NO
...@@ -24,7 +24,7 @@ inline void range_check(iterator begin, iterator end, size_t read_size) ...@@ -24,7 +24,7 @@ inline void range_check(iterator begin, iterator end, size_t read_size)
} }
} }
// @return the next iterator position // @returnss the next iterator position
template<typename T> template<typename T>
iterator read(iterator, iterator, T&, iterator read(iterator, iterator, T&,
typename enable_if< std::is_floating_point<T> >::type* = 0) typename enable_if< std::is_floating_point<T> >::type* = 0)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include "cppa/atom.hpp" #include "cppa/atom.hpp"
#include "cppa/match.hpp" #include "cppa/match.hpp"
#include "cppa/context.hpp" #include "cppa/local_actor.hpp"
#include "cppa/exit_reason.hpp" #include "cppa/exit_reason.hpp"
#include "cppa/invoke_rules.hpp" #include "cppa/invoke_rules.hpp"
......
...@@ -20,7 +20,7 @@ class observer : public cppa::attachable ...@@ -20,7 +20,7 @@ class observer : public cppa::attachable
{ {
if (match_token.subtype == typeid(observer)) if (match_token.subtype == typeid(observer))
{ {
auto ptr = reinterpret_cast<const cppa::context*>(match_token.ptr); auto ptr = reinterpret_cast<const cppa::local_actor*>(match_token.ptr);
return m_client == ptr; return m_client == ptr;
} }
return false; return false;
...@@ -32,14 +32,14 @@ class observer : public cppa::attachable ...@@ -32,14 +32,14 @@ class observer : public cppa::attachable
namespace cppa { namespace cppa {
context* operator<<(context* whom, const any_tuple& what) local_actor* operator<<(local_actor* whom, const any_tuple& what)
{ {
if (whom) whom->enqueue(message(self(), whom, what)); if (whom) whom->enqueue(message(self(), whom, what));
return whom; return whom;
} }
// matches self() << make_tuple(...) // matches self() << make_tuple(...)
context* operator<<(context* whom, any_tuple&& what) local_actor* operator<<(local_actor* whom, any_tuple&& what)
{ {
if (whom) whom->enqueue(message(self(), whom, std::move(what))); if (whom) whom->enqueue(message(self(), whom, std::move(what)));
return whom; return whom;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// needed unless the new keyword "thread_local" works in GCC // needed unless the new keyword "thread_local" works in GCC
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include "cppa/context.hpp" #include "cppa/local_actor.hpp"
#include "cppa/message.hpp" #include "cppa/message.hpp"
#include "cppa/scheduler.hpp" #include "cppa/scheduler.hpp"
...@@ -12,7 +12,7 @@ using cppa::detail::converted_thread_context; ...@@ -12,7 +12,7 @@ using cppa::detail::converted_thread_context;
namespace { namespace {
void cleanup_fun(cppa::context* what) void cleanup_fun(cppa::local_actor* what)
{ {
auto ptr = dynamic_cast<converted_thread_context*>(what); auto ptr = dynamic_cast<converted_thread_context*>(what);
if (ptr) if (ptr)
...@@ -23,25 +23,25 @@ void cleanup_fun(cppa::context* what) ...@@ -23,25 +23,25 @@ void cleanup_fun(cppa::context* what)
if (what && !what->deref()) delete what; if (what && !what->deref()) delete what;
} }
boost::thread_specific_ptr<cppa::context> t_this_context(cleanup_fun); boost::thread_specific_ptr<cppa::local_actor> t_this_context(cleanup_fun);
} // namespace <anonymous> } // namespace <anonymous>
namespace cppa { namespace cppa {
void context::enqueue(const message& msg) void local_actor::enqueue(const message& msg)
{ {
mailbox().enqueue(msg); mailbox().enqueue(msg);
} }
context* unchecked_self() local_actor* unchecked_self()
{ {
return t_this_context.get(); return t_this_context.get();
} }
context* self() local_actor* self()
{ {
context* result = t_this_context.get(); local_actor* result = t_this_context.get();
if (result == nullptr) if (result == nullptr)
{ {
result = new converted_thread_context; result = new converted_thread_context;
...@@ -52,7 +52,7 @@ context* self() ...@@ -52,7 +52,7 @@ context* self()
return result; return result;
} }
void set_self(context* ctx) void set_self(local_actor* ctx)
{ {
if (ctx) ctx->ref(); if (ctx) ctx->ref();
t_this_context.reset(ctx); t_this_context.reset(ctx);
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "cppa/message.hpp" #include "cppa/message.hpp"
#include "cppa/context.hpp" #include "cppa/local_actor.hpp"
#include "cppa/scheduler.hpp" #include "cppa/scheduler.hpp"
#include "cppa/attachable.hpp" #include "cppa/attachable.hpp"
#include "cppa/invoke_rules.hpp" #include "cppa/invoke_rules.hpp"
...@@ -22,7 +22,7 @@ using std::endl; ...@@ -22,7 +22,7 @@ using std::endl;
namespace { namespace {
void run_actor(cppa::intrusive_ptr<cppa::context> m_self, void run_actor(cppa::intrusive_ptr<cppa::local_actor> m_self,
cppa::actor_behavior* behavior) cppa::actor_behavior* behavior)
{ {
cppa::set_self(m_self.get()); cppa::set_self(m_self.get());
...@@ -45,7 +45,7 @@ actor_ptr mock_scheduler::spawn(actor_behavior* behavior) ...@@ -45,7 +45,7 @@ actor_ptr mock_scheduler::spawn(actor_behavior* behavior)
{ {
inc_actor_count(); inc_actor_count();
CPPA_MEMORY_BARRIER(); CPPA_MEMORY_BARRIER();
intrusive_ptr<context> ctx(new detail::converted_thread_context); intrusive_ptr<local_actor> ctx(new detail::converted_thread_context);
thread(run_actor, ctx, behavior).detach(); thread(run_actor, ctx, behavior).detach();
return ctx; return ctx;
} }
......
...@@ -138,7 +138,7 @@ class post_office_worker ...@@ -138,7 +138,7 @@ class post_office_worker
return m_parent; return m_parent;
} }
// @return new reference count // @returnss new reference count
size_t parent_exited(native_socket_t parent_socket) size_t parent_exited(native_socket_t parent_socket)
{ {
if (has_parent() && parent() == parent_socket) if (has_parent() && parent() == parent_socket)
...@@ -230,7 +230,7 @@ class po_peer : public post_office_worker ...@@ -230,7 +230,7 @@ class po_peer : public post_office_worker
} }
} }
// @return false if an error occured; otherwise true // @returnss false if an error occured; otherwise true
bool read_and_continue() bool read_and_continue()
{ {
switch (m_state) switch (m_state)
...@@ -381,7 +381,7 @@ class po_doorman : public post_office_worker ...@@ -381,7 +381,7 @@ class po_doorman : public post_office_worker
{ {
} }
// @return false if an error occured; otherwise true // @returnss false if an error occured; otherwise true
bool read_and_continue() bool read_and_continue()
{ {
sockaddr addr; sockaddr addr;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#include <iostream> #include <iostream>
#include "cppa/on.hpp" #include "cppa/on.hpp"
#include "cppa/context.hpp" #include "cppa/local_actor.hpp"
#include "cppa/scheduler.hpp" #include "cppa/scheduler.hpp"
#include "cppa/to_string.hpp" #include "cppa/to_string.hpp"
...@@ -156,7 +156,7 @@ void scheduler::await_others_done() ...@@ -156,7 +156,7 @@ void scheduler::await_others_done()
detail::actor_count_wait_until((unchecked_self() == nullptr) ? 0 : 1); detail::actor_count_wait_until((unchecked_self() == nullptr) ? 0 : 1);
} }
void scheduler::register_converted_context(context* what) void scheduler::register_converted_context(local_actor* what)
{ {
if (what) if (what)
{ {
...@@ -171,7 +171,7 @@ attachable* scheduler::register_hidden_context() ...@@ -171,7 +171,7 @@ attachable* scheduler::register_hidden_context()
return new exit_observer; return new exit_observer;
} }
void scheduler::exit_context(context* ctx, std::uint32_t reason) void scheduler::exit_context(local_actor* ctx, std::uint32_t reason)
{ {
ctx->quit(reason); ctx->quit(reason);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#include <iostream> #include <iostream>
#include "cppa/message.hpp" #include "cppa/message.hpp"
#include "cppa/context.hpp" #include "cppa/local_actor.hpp"
#include "cppa/scheduler.hpp" #include "cppa/scheduler.hpp"
#include "cppa/exception.hpp" #include "cppa/exception.hpp"
......
#include <iostream> #include <iostream>
#include "cppa/config.hpp" #include "cppa/config.hpp"
#include "cppa/context.hpp" #include "cppa/local_actor.hpp"
#include "cppa/util/fiber.hpp" #include "cppa/util/fiber.hpp"
#include "cppa/actor_behavior.hpp" #include "cppa/actor_behavior.hpp"
#include "cppa/detail/actor_count.hpp" #include "cppa/detail/actor_count.hpp"
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "cppa/cppa.hpp" #include "cppa/cppa.hpp"
#include "cppa/match.hpp" #include "cppa/match.hpp"
#include "cppa/context.hpp" #include "cppa/local_actor.hpp"
#include "cppa/scheduler.hpp" #include "cppa/scheduler.hpp"
#include "cppa/exit_reason.hpp" #include "cppa/exit_reason.hpp"
#include "cppa/invoke_rules.hpp" #include "cppa/invoke_rules.hpp"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment