02-15-2013 02:56 AM
In all parallell programming you'll run into race conditions of sorts, AE's has the same problem as any other solution.
I've included an example which has both AE as counter and user events which you could use as counter (instead of only as stopping message as now). However, if you check the number of instances too fast all might not have started yet and you can get a "wrong" value. Once all have started the number is correct. That's regardless of whether you use database, AE or events.
/Y
02-15-2013 03:16 AM
Hi tst
What do you mean by 'not returned by the All VIs property.'
02-15-2013 03:25 AM - edited 02-15-2013 03:28 AM
tst,
See this reading processing writing is 3 different independent processes. Like i said before in my all the VIs database is must so using additionally for one more job is good idea for me (As i dont want to FGV becasue i dont trust it anymore )).
Like i said & explained in my earlier post in this question only that this wont create any race condition of any kind although there are multiple clients.
Please tell me what are the other method to implement this and i never said only DB is solution but i think this is convenient for me becasue no FGV for me & other methods i dont know.
This list issue as soon as VI execution is over it will freed from lists
i didn't understand you line
------------------------------------------------------------------------------------------------------------------------------------------------------------
Logging them at creation time will only work if you do it before you run the VI and it won't help when the VI stops
------------------------------------------------------------------------------------------------------------------------------------------------------------
02-15-2013 04:44 AM
If you change the delay to 2000 in the reentrant starter loop you'll see that the event loop slowly increases until all have started. If you read the value during the startup phase you'll get a value different from the end value. That's true whether you handle it with events, AE or DB. Actually, since DB is the slowest of them, it's the highest probability of being "behind" in counting.
If you're going the DB route you'll need to do it as a transaction.
If the program starts checking after a short time (1 sec?) it's not an issue regardless of solution.
So, how fast are you going to start checking for the processes and what's the area of usage? Checking if they've all finished? Then my example is a good solution.
/Y
02-15-2013 06:53 AM
Ranjeet, look at what Yamaeda posted. It shows exactly how to do this using an FGV. The only problem with the example is that it the VIs don't stop on their own, but that could be easily added by adding a random timeout to each VI.
If you want another way to do this, it could be done, for instance, with a parallel process to which you send events to increment or decrement the value. This is basically similar to your DB method, only these events are like stored procedures.
If you really care about this, I suggest you take Yamaeda's example and modify it so that it works with a DB and then upload it. We'll understand how it works even if we don't have the DB and we can tell you if there's a problem with it.
Jeff suggested going over all the VIs and I said that it probably won't work (and now I tested and can confirm that it doesn't work)/
02-15-2013 06:54 AM
@Ranjeet_Singh wrote:
Hi @tst
What do you mean by 'not returned by the All VIs property.'
Jeff suggested going over all the VIs to check if they're clones and I said that it probably won't work (and now I tested and can confirm that it doesn't work).
02-15-2013 07:14 AM
Yes it was originally a reentrant test with user events to stop, i added the AE as counter. 🙂
To more closely simulate your situation you can e.g. add a random(+3000) value to the timeout and close the sub-vi in the timeout. That way they'll stop after a short time OR if you press the main vi's stop.
/Y
02-17-2013 10:38 PM
Hi tst,
I have already implemented this is TCP application but cant upload my entire code becasue of privacy (Office Rules). Why i was focusing on this is i already had bitter experience with FGV & DB is another option for me. So for me its ok. You all are using FGV & i am using DB 1 table as global variable. Doesn't matter.