Neverlord on 1368
Provide `*_weak` variants of `s… Merge pull request #1368 Documentation nitpicks (compare)
Neverlord on 1370
Neverlord on master
address unsafe sprintf usage Merge pull request #1370 Style nitpick and 1 more (compare)
Neverlord on 1370
address unsafe sprintf usage Merge pull request #1370 Style nitpick (compare)
Neverlord on neverlord
Neverlord on master
Enable Cirrus while our Jenkins… Disable async.blocking_consumer… Merge branch 'topic/neverlord/c… (compare)
Neverlord on neverlord
Enable Cirrus while our Jenkins… Disable async.blocking_consumer… (compare)
@Neverlord Hello Dominik. We experiencing some strange caf behavior. Our CAF version is 0.17.4. We have library that has event_based_actors. Library has some method with return values, so is blocking by nature. To work with this actors we use this pseudo code
caf::scoped_actor self{system_}; int result = -1; self ->request() .receive( [&](...) { ... }, [&](caf::error& err) { ...; }); return result;
With this code we experiencing timeout before our application with loaded library exits about 30 seconds.
We can reproduce that still one line:caf::scoped_actor self{system_};
Strangely we already have the same problem. :-)
curl
manually works for an ad-hoc analysis.
using init_atom = atom_constant<atom("init")>;
using calc_atom = atom_constant<atom("calc")>;
using wait_atom = atom_constant<atom("wait")>;
@Kadzugi_gitlab the new pattern matching with 0.18 uses type IDs. Atoms still kinda exist, but they are simple, empty structs now. Basically:
CAF_BEGIN_TYPE_ID_BLOCK(my_types, caf::first_custom_type_id)
CAF_ADD_ATOM(my_types, my_ns, init_atom)
CAF_ADD_ATOM(my_types, my_ns, calc_atom)
CAF_ADD_ATOM(my_types, my_ns wait_atom)
CAF_END_TYPE_ID_BLOCK(my_types)
This gives you the atom types my_ns::init_atom
, etc. To obtain a value, just type my_ns::init_atom_v
. You can also leave out the namespace if you wish. The new types must be registered at runtime, or you will most likely run into segfaults. Have a look at https://github.com/actor-framework/actor-framework/blob/master/examples/custom_type/custom_types_1.cpp. If you're not using the CAF_MAIN
macro, you'll need to call something like:
caf::init_global_meta_objects<caf::id_block::my_types>();
caf::core::init_global_meta_objects();
Loading the middleman requires calling caf::io::init_global_meta_objects
.
Hope that gets you started. The transition to 0.18 is a big one, but it's been worth it. 🙂
Hi, i am wondering if i understand the new type inspection correctly.
Currently it is called like so:f(caf::meta::type_name("type"), x);
Is there a difference betweenf.object(x).pretty_name("type");
f.apply(x);
and
f.object(x).pretty_name("type").fields(f.field("x", x));
If i understood it correctly the second version will also be human readable if needed.
@Neverlord Hello Dominik, we continue to rewrite tests for version 0.18.6. Another question appeared, when connecting file caf/test/unit_test_impl.hpp, connection code:
#define CAF_SUITE main_test
#include <caf/test/unit_test_impl.hpp>
CAF_TEST(main) {
CAF_CHECK_EQUAL(1, 1);
}
the following errors occur:
1) package\9e2288acb3ac24a42092c8fd8c34ee883b3fb639\include\caf/test/unit_test_impl.hpp(660,8): error C2039: 'core': is not a member of 'caf'
2) package\9e2288acb3ac24a42092c8fd8c34ee883b3fb639\include\caf/test/unit_test_impl.hpp(30): message : see declaration of 'caf'
3) package\9e2288acb3ac24a42092c8fd8c34ee883b3fb639\include\caf/test/unit_test_impl.hpp(660,8): error C3083: 'core': the symbol to the left of a '::' must be a type
4) package\9e2288acb3ac24a42092c8fd8c34ee883b3fb639\include\caf/test/unit_test_impl.hpp(660,14): error C2039: 'init_global_meta_objects': is not a member of 'caf'
Can you please tell me what the problem is?
main
anymore.
#define CAF_TEST_NO_MAIN
before including the impl
header and then initialize the type-id table according to your needs.
map<strong_actor_ptr, value_type>
and run the algorithm whenever you have three entries after receiving something (and override the entry for the sender otherwise).
--disable-shared-libs
(configure script) or BUILD_SHARED_LIBS=OFF
(CMake).
@Neverlord Hi thanks for the clarification, makes sense to give actor the chance to process all messages, we do the same at a higher level. We will adapt our design accordingly. Would be interesting to document this behavior a little bit in the user manual. On my test (windows box, x64 release) , I send a bunch of high priority messages, then a bunch of normal priority messages and the actor eventually processes 9 high priority messages for 3 normal priority messages (3 to 1 ratio), until the test finishes.
caf::message_priority::high : 1444419
caf::message_priority::normal : 3
caf::message_priority::high : 9
caf::message_priority::normal : 3
caf::message_priority::high : 9
caf::message_priority::normal : 3
caf::message_priority::high : 9
caf::message_priority::normal : 3
Have a nice day!