Boost logo

Boost Users :

Subject: Re: [Boost-users] Questions about packaged_task , Promise and serialization of a class object and event handling
From: Igor R (boost.lists_at_[hidden])
Date: 2012-04-15 14:29:38

First of all, please read thoroughly the following article:

> whats the different between read_some and async_read_some ? in asio ?

The former is synchronous, the latter is asynchronous. I recommend you
to read the asio docs.

> i know that when i need to send an argument to event handler ( signal  ) , i
> frist should declare sth like this :
>> boost::signal2::signal <function-return-type (paramerter type)> mysignal ;
>> mysignal.connect(myfunc,my-functions-argumant);
>> mysignal.connect(myfunc2,my-function2s-argumant);
> now if i have couple of functions with the same signature , doing different
> jobs with different arguments , how can i give their respective arguments ?
> i mean at the moment , i can only write :
> mysignal(5);!
> and this passes 5 to all functions connected with this signal! do i really
> have to make one signal for each functions ?so that i can pass different and
> yet with the same type argument to different functions using one signal .
> is'nt there any other way around it ?

I think it's not a technical issue, but a design one. A signal signals
(sends some information) to all its slots. It cannot and should not
distinguish between its slots. If your slots should receive different
info from a signal, then probably they actually should connect
*different* signals.

> if inside a signal , i run a thread and then i block that signal using
> signal.block , would that block that thread too ? and then unblocking it
> would it unblock that thread too ? is it safe doing this ?

Have you read the documentation?
How is blocking a signal related to threads?

> why do we use function names with const that the end of it ?

Unrelated to boost.

> how do i serialize a class of mine ? i mean i read that if i have vector , i
> need to use some functions , if i have foo i need another function ! what
> exactly do you serialize your classes ? i mean maybe i have std::string ,
> char , vectors of some kind , and a self made class or type used in my class
> to be serialized , how should i go about it . any guidance is greatly
> appreciated  .

Here you can find a trivial example, as well as more advanced ones:

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at