Boost logo

Boost Users :

Subject: [Boost-users] Boost intrusive list volatile hook
From: nat ersoz (natersoz_at_[hidden])
Date: 2018-11-25 17:37:38


I intend to use the boost intrusive list to implement an observer pattern.

   - The list will cross interrupt boundaries; meaning one interrupt will
   produce the notifications and the other interrupt will observer the
   notifications.

   - The observer, in response to a notification, might detach itself from
   the list using the the hook's unlink() function.

   - I think that I will need the hook to be declared volatile in order to
   accommodate this.

I have a minimal code sample here:
https://github.com/natersoz/patterns/blob/master/observer/intrusive_list_member/test_observer_minimal.cc

My list hook member declaration:

    using list_hook_type = boost::intrusive::list_member_hook<
        boost::intrusive::link_mode<boost::intrusive::auto_unlink>
>;

    list_hook_type hook;

My list declaration:

    using list_type =
    boost::intrusive::list<
        Observer<NotificationType>,
        boost::intrusive::constant_time_size<false>,
        boost::intrusive::member_hook<
            Observer<NotificationType>,
            typename Observer<NotificationType>::list_hook_type,
            &Observer<NotificationType>::hook>
>;

If I a the volatile keyword to the list hood type, I cannot figure out how
to get the list_type declaration to fit into the list template list.

Is it possible?

Thank you.

-- 
Nat Ersoz
425-417-5182 (cell)


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net