Menu

#71 thread-safe session handling using tss

None
closed-duplicate
nobody
None
5
2017-09-04
2012-10-19
No

QuantLib default session handling is thread safe only if you allocate all sessions beforehand, otherwise adding/removing a session id changes the map object potentially corrupting other thread iterators.
This patch uses boost::thread_specific_ptr to have a per-thread session id. Since the variable used is thread-private and inherently linked to the thread, no sessionId() method is needed.
The patch is enabled by defining QL_ENABLE_SESSIONS_TSS in config.hpp
Without the define QuantLib uses the old code.

Discussion

  • Riccardo Ghetta

    Riccardo Ghetta - 2012-10-19

    thread-safe sessions patch

     
  • Luigi Ballabio

    Luigi Ballabio - 2017-09-04
    • status: open --> closed-duplicate
    • Group: -->
     

Log in to post a comment.