Prototype changes to sessions and singletons

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Prototype changes to sessions and singletons

Luigi Ballabio
Hi all,
    I've just pushed on GitHub two branches with contributions from
mortoray and Riccardo Ghetta. The first is at
<https://github.com/lballabio/quantlib/tree/generalized-sessions> and
provides a generalized mechanism to provide multiple sessions in
multi-threaded programs using QuantLib.  The second is at
<https://github.com/lballabio/quantlib/tree/thread-local-singleton>
and implements a simpler modification that causes each thread to have
its own session. I'd be grateful if someone could check them out, try
them, and comment.

Thanks,
    Luigi

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Prototype changes to sessions and singletons

Klaus Spanderen-2

Hi Luigi

 

even though I currently use a solution very simillar to the "generalized-sessions" I'd now prefer the thread-local-singleton because the contract does not depend on an external sessionId function. If we change the singleton implementation then IMO we should also change the observer/observable implementation to use boost::signal2 in order to make this pattern more thread-safe (I can provide an signal2 based implementation if you want).

 

regards

Klaus

 

On Wednesday, June 12, 2013 04:00:01 PM Luigi Ballabio wrote:

> Hi all,

> I've just pushed on GitHub two branches with contributions from

> mortoray and Riccardo Ghetta. The first is at

> <https://github.com/lballabio/quantlib/tree/generalized-sessions> and

> provides a generalized mechanism to provide multiple sessions in

> multi-threaded programs using QuantLib. The second is at

> <https://github.com/lballabio/quantlib/tree/thread-local-singleton>

> and implements a simpler modification that causes each thread to have

> its own session. I'd be grateful if someone could check them out, try

> them, and comment.

>

> Thanks,

> Luigi

>

> ----------------------------------------------------------------------------

> -- This SF.net email is sponsored by Windows:

>

> Build for Windows Store.

>

> http://p.sf.net/sfu/windows-dev2dev

> _______________________________________________

> QuantLib-users mailing list

> [hidden email]

> https://lists.sourceforge.net/lists/listinfo/quantlib-users


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Prototype changes to sessions and singletons

Luigi Ballabio
Hi Klaus,
    yes, boost::signal was also on my wish list.  With regard to
singletons, the ideal change would be doing away with them entirely;
but I'm not sure how to do it yet (the general idea would be to turn
the Settings class into some kind of Context class, of which one could
have different instances to pass to instruments etc., but here might
be problems in making sure that, for instance, an instrument and the
curves it's using are in the same context. I'm open to ideas, of
course.)

All of this would not be backward compatible with the current library.
It might be a version 2.0. It might also be the excuse to ditch older
compilers and start using C++11 features. In short, you all would have
to force me to get my acts together and stop stagnating :)

Thoughts everyone?

Luigi


On Sat, Jun 15, 2013 at 4:54 PM, Klaus Spanderen <[hidden email]> wrote:

> Hi Luigi
>
>
>
> even though I currently use a solution very simillar to the
> "generalized-sessions" I'd now prefer the thread-local-singleton because the
> contract does not depend on an external sessionId function. If we change the
> singleton implementation then IMO we should also change the
> observer/observable implementation to use boost::signal2 in order to make
> this pattern more thread-safe (I can provide an signal2 based implementation
> if you want).
>
>
>
> regards
>
> Klaus
>
>
>
> On Wednesday, June 12, 2013 04:00:01 PM Luigi Ballabio wrote:
>
>> Hi all,
>
>> I've just pushed on GitHub two branches with contributions from
>
>> mortoray and Riccardo Ghetta. The first is at
>
>> <https://github.com/lballabio/quantlib/tree/generalized-sessions> and
>
>> provides a generalized mechanism to provide multiple sessions in
>
>> multi-threaded programs using QuantLib. The second is at
>
>> <https://github.com/lballabio/quantlib/tree/thread-local-singleton>
>
>> and implements a simpler modification that causes each thread to have
>
>> its own session. I'd be grateful if someone could check them out, try
>
>> them, and comment.
>
>>
>
>> Thanks,
>
>> Luigi
>
>>
>
>>
>> ----------------------------------------------------------------------------
>
>> -- This SF.net email is sponsored by Windows:
>
>>
>
>> Build for Windows Store.
>
>>
>
>> http://p.sf.net/sfu/windows-dev2dev
>
>> _______________________________________________
>
>> QuantLib-users mailing list
>
>> [hidden email]
>
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users