Hi, A friend pointed me at this library, as it may solve a problem for me. Am I correct in thinking that a signal can be activated once all of its slots are filled and not before? Best wishes. Tim Burgess Raised Bar Ltd. E: <mailto:tim@raisedbar.net> tim@raisedbar.net M: +44 (0)7989 486976
On Thu, Oct 4, 2018 at 9:51 AM Tim Burgess via Boost-users <boost-users@lists.boost.org> wrote:
Hi,
A friend pointed me at this library, as it may solve a problem for me.
Which problem is?
Am I correct in thinking that a signal can be activated once all of its slots are filled and not before?
It's been awhile since I last used Boost and/or Signals2... But if memory serves, it is the C++ analog to C# events and event handlers. I'm not sure what you mean "activated". In event terms, raising the event, perhaps? My understanding is that you can raise the event, but there does not necessarily need to be an event handler on the other end of the callback. Although, from my experience designing event driven systems, there usually is, I think.
Best wishes.
Tim Burgess Raised Bar Ltd. E: tim@raisedbar.net M: +44 (0)7989 486976
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi, I've raised my issue here before, but failed to express it with sufficient clarity. I'm writing an editor for a MIDI device, so have a c++ class that has members for each parameter in the device. In my constructor I cause MIDI messages to be generated that query the hardware to get its current parameter values, so you can imagine a function like: Void QueryParameter( unsigned int nParameterNumber); The only means of receiving values back from the hardware is via a callback implemented by the MIDI library I'm using and the manufacturer tells me that I should do as follows: QueryParameter(1); // Wait for the callback to deliver a value for parameter 1 QueryParameter(2); // Wait again ... Failing to wait causes loss of data due to buffer overruns. I was wondering if I could use slots and signals to achieve this behaviour, with my existing callback filling slots and QueryParameter() being modified to wait for the combiner to be triggered. Is my understanding anything near sane? Best wishes. Tim Burgess -----Original Message----- From: Boost-users <boost-users-bounces@lists.boost.org> On Behalf Of Michael Powell via Boost-users Sent: 04 October 2018 15:17 To: boost-users@lists.boost.org Cc: Michael Powell <mwpowellhtx@gmail.com> Subject: Re: [Boost-users] signals2 On Thu, Oct 4, 2018 at 9:51 AM Tim Burgess via Boost-users <boost-users@lists.boost.org> wrote:
Hi,
A friend pointed me at this library, as it may solve a problem for me.
Which problem is?
Am I correct in thinking that a signal can be activated once all of its slots are filled and not before?
It's been awhile since I last used Boost and/or Signals2... But if memory serves, it is the C++ analog to C# events and event handlers. I'm not sure what you mean "activated". In event terms, raising the event, perhaps? My understanding is that you can raise the event, but there does not necessarily need to be an event handler on the other end of the callback. Although, from my experience designing event driven systems, there usually is, I think.
Best wishes.
Tim Burgess Raised Bar Ltd. E: tim@raisedbar.net M: +44 (0)7989 486976
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
Is my understanding anything near sane? I'm afraid not: a signal invokes all slots currently in its list. There is no concept of "all slots" being present and there is no concept of waiting either. I'd suggest to use a proper blocking synchronization mechanism for this, e.g., a semaphore. So 1. Create a semaphore with initial value 0 2. QueryParameter(1) 3. Wait on semaphore In the callback, do the work and release / increment the semaphore. Repeat for every parameter. ________________________________ From: Boost-users <boost-users-bounces@lists.boost.org> on behalf of Tim Burgess via Boost-users <boost-users@lists.boost.org> Sent: Thursday, October 4, 2018 4:31:38 PM To: boost-users@lists.boost.org Cc: tim@raisedbar.net Subject: Re: [Boost-users] signals2 Hi, I've raised my issue here before, but failed to express it with sufficient clarity. I'm writing an editor for a MIDI device, so have a c++ class that has members for each parameter in the device. In my constructor I cause MIDI messages to be generated that query the hardware to get its current parameter values, so you can imagine a function like: Void QueryParameter( unsigned int nParameterNumber); The only means of receiving values back from the hardware is via a callback implemented by the MIDI library I'm using and the manufacturer tells me that I should do as follows: QueryParameter(1); // Wait for the callback to deliver a value for parameter 1 QueryParameter(2); // Wait again ... Failing to wait causes loss of data due to buffer overruns. I was wondering if I could use slots and signals to achieve this behaviour, with my existing callback filling slots and QueryParameter() being modified to wait for the combiner to be triggered. Is my understanding anything near sane? Best wishes. Tim Burgess -----Original Message----- From: Boost-users <boost-users-bounces@lists.boost.org> On Behalf Of Michael Powell via Boost-users Sent: 04 October 2018 15:17 To: boost-users@lists.boost.org Cc: Michael Powell <mwpowellhtx@gmail.com> Subject: Re: [Boost-users] signals2 On Thu, Oct 4, 2018 at 9:51 AM Tim Burgess via Boost-users <boost-users@lists.boost.org> wrote:
Hi,
A friend pointed me at this library, as it may solve a problem for me.
Which problem is?
Am I correct in thinking that a signal can be activated once all of its slots are filled and not before?
It's been awhile since I last used Boost and/or Signals2... But if memory serves, it is the C++ analog to C# events and event handlers. I'm not sure what you mean "activated". In event terms, raising the event, perhaps? My understanding is that you can raise the event, but there does not necessarily need to be an event handler on the other end of the callback. Although, from my experience designing event driven systems, there usually is, I think.
Best wishes.
Tim Burgess Raised Bar Ltd. E: tim@raisedbar.net M: +44 (0)7989 486976
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
Michael Powell
-
Stian Zeljko Vrba
-
tim@raisedbar.net