11-26-2015 12:59 AM
@billko wrote:
I don't know about the race condition thing, though. It seems to me that you really shouldn't be updating front panel objects from more than one place anyway (race condition avoided).
That's why I didn't say it leads to race conditions, rather that it makes it easier to create them. Take your HD activity light example as an example - Turning the light on is easy enough. Anyone can do it. How about turning it off? You need to give that responsibility to someone. If you're changing the appearance of the indicator through properties, you're basically stuck with a loop running somewhere and occasionally resetting it, which means you're polling and the light will not be on for consistent times. An exception to this would be if you use Value(sgnl) and register for that event, and then you can use the timeout on that to turn it off, but that requires all your users to use the Value(sgnl) property and if one doesn't, your light will stay on until someone does.
I don't know if I would call it lazy and sloppy, but it does have its issues. A situation like above is less likely in your "init the controls" case, but it something to be aware of. I will point out that my plugin does create a typedef for the references, but even so, I don't think I ever used it in actual code.
11-26-2015 08:24 AM
@tst wrote:
@billko wrote:I don't know about the race condition thing, though. It seems to me that you really shouldn't be updating front panel objects from more than one place anyway (race condition avoided).
That's why I didn't say it leads to race conditions, rather that it makes it easier to create them. Take your HD activity light example as an example - Turning the light on is easy enough. Anyone can do it. How about turning it off? You need to give that responsibility to someone. If you're changing the appearance of the indicator through properties, you're basically stuck with a loop running somewhere and occasionally resetting it, which means you're polling and the light will not be on for consistent times. An exception to this would be if you use Value(sgnl) and register for that event, and then you can use the timeout on that to turn it off, but that requires all your users to use the Value(sgnl) property and if one doesn't, your light will stay on until someone does.
I don't know if I would call it lazy and sloppy, but it does have its issues. A situation like above is less likely in your "init the controls" case, but it something to be aware of. I will point out that my plugin does create a typedef for the references, but even so, I don't think I ever used it in actual code.
I think we are on the same page. Any time you add another layer of complexity, you need to be that much more vigilant with your programming.