Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct msg_connect : msg<msg_connect>
- {
- string addr;
- uint16_t port;
- };
- struct msg_send_packet : msg<msg_send_packet>
- {
- void* data;
- size_t size;
- };
- class socket : public agent<socket>
- {
- void on_event(event_t<msg_connect> ev)
- {
- }
- void on_event(event_t<msg_send_packet> ev)
- {
- }
- };
- socket::handle s = socket::create(...);
- s->send(msg_connect::create("localhost", 80));
- s->send(msg_send_packet::create(&data[0] data.size());
- class form �
- {
- void on_event(join_event<msg_db_load_ack, msg_show> ev)
- {
- // activated when both messages arrive
- }
- };
- class form �
- {
- void on_event(read_event<msg_get_info> ev) const
- {
- // can be executed concurrently with other read_events
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement