LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I found out how many clients are currently registered for a User Event

My application uses User Events to implement a publisher/subscriber pattern.

The publisher is responsible for collecting information from the resource(s) that it manages, and publishes updates to its subscribers. If there are no subscribers, there is no need for the publisher to do any work.

How can the publisher determine how many active registrations ("Register for events") there are on a User Event?

0 Kudos
Message 1 of 5
(2,512 Views)

I don't think you can unless you somehow send messages back to the producer when something is registered and unregistered.  I say just go ahead and publish the data.  If nobody is listening, then it will disappear into the ether.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 5
(2,509 Views)

@crossrulz wrote:

I don't think you can unless you somehow send messages back to the producer when something is registered and unregistered.  I say just go ahead and publish the data.  If nobody is listening, then it will disappear into the ether.


Being an anal retentive neat freak, it makes me feel uncomfortable to leave a thread running for no apparent reason.

Are you sure it'll disappear, and not become a memory leak?

0 Kudos
Message 3 of 5
(2,504 Views)

mflegel wrote:

Are you sure it'll disappear, and not become a memory leak?


I am 98% sure.  I'm trying to remember the details I was given back at NI Week.  Each registration has a FIFO.  If the event isn't registered, then the data isn't copied into a FIFO (think FOR loop autoindexing an empty array).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 5
(2,495 Views)

Well when you throw the dynamic event it simply queues to any event structures that are registered to recieve the event.  If the number of such event queues is zero exactly zero queues copy the event data.  In essence you create a zero width buffer at no location. Or, to state it differently- it disapears into the ether.


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 5
(2,493 Views)