Thread Safe Quantlib

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

Thread Safe Quantlib

Subramaniam V
hi

Has somebody tried using latest Quantlib 1.7 in multithreaded environment in C++?
I am confused as to if it is threadsafe, (assuming I am using Boost 1.58) with the .configure option (as specified in https://sourceforge.net/projects/quantlib/files/QuantLib/1.7/).

Another web page at
talks about thread safety only with thread local singleton pattern.

I am slightly confused, is the latest version(1.7) thread safe without using thread local singleton patten? or do we still need to use the thread local singleton pattern.

Any other insights into thread safety would be greatly welcome.

Thank you!

--
Subramaniam

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Thread Safe Quantlib

Luigi Ballabio
Hello,
    QuantLib is generally not thread-safe.  The thread-local singleton pattern gives you per-thread singletons instead of global ones, but it doesn't prevent race conditions if you share objects between threads.  The configure option --enable-thread-safe-observer-pattern was added because, when QuantLib is exported to C# or Java, the garbage collector would sometime cause a race with notifications in the library; the option prevents this, but it doesn't help with any of the other possible problems with caches or lazy calculations. I suggest to use multiple processes instead.

Luigi



On Mon, Jun 6, 2016 at 5:56 AM Subramaniam V <[hidden email]> wrote:
hi

Has somebody tried using latest Quantlib 1.7 in multithreaded environment in C++?
I am confused as to if it is threadsafe, (assuming I am using Boost 1.58) with the .configure option (as specified in https://sourceforge.net/projects/quantlib/files/QuantLib/1.7/).

Another web page at
talks about thread safety only with thread local singleton pattern.

I am slightly confused, is the latest version(1.7) thread safe without using thread local singleton patten? or do we still need to use the thread local singleton pattern.

Any other insights into thread safety would be greatly welcome.

Thank you!

--
Subramaniam
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users