signals2

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

signals2

Boost - Users mailing list

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: [hidden email]

M: +44 (0)7989 486976

 


_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: signals2

Boost - Users mailing list
On Thu, Oct 4, 2018 at 9:51 AM Tim Burgess via Boost-users
<[hidden email]> 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: [hidden email]
> M: +44 (0)7989 486976
>
>
>
> _______________________________________________
> Boost-users mailing list
> [hidden email]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: signals2

Boost - Users mailing list
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 <[hidden email]> On Behalf Of Michael
Powell via Boost-users
Sent: 04 October 2018 15:17
To: [hidden email]
Cc: Michael Powell <[hidden email]>
Subject: Re: [Boost-users] signals2

On Thu, Oct 4, 2018 at 9:51 AM Tim Burgess via Boost-users
<[hidden email]> 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: [hidden email]
> M: +44 (0)7989 486976
>
>
>
> _______________________________________________
> Boost-users mailing list
> [hidden email]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: signals2

Boost - Users mailing list


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 <[hidden email]> on behalf of Tim Burgess via Boost-users <[hidden email]>
Sent: Thursday, October 4, 2018 4:31:38 PM
To: [hidden email]
Cc: [hidden email]
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 <[hidden email]> On Behalf Of Michael
Powell via Boost-users
Sent: 04 October 2018 15:17
To: [hidden email]
Cc: Michael Powell <[hidden email]>
Subject: Re: [Boost-users] signals2

On Thu, Oct 4, 2018 at 9:51 AM Tim Burgess via Boost-users
<[hidden email]> 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: [hidden email]
> M: +44 (0)7989 486976
>
>
>
> _______________________________________________
> Boost-users mailing list
> [hidden email]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users