02-06-2012 02:46 PM
Hi Double_D,
To give you an explanation of why removing the 'static int' caused your program to work, refer to the CVI Help for PanelHandle. You may notice that the return value for this is an int. Therefore, assigning it as a static int is essentially causing a type mismatch. This was probably contributing to the error you were seeing.
Regards,
Jackie
02-06-2012 05:05 PM
I figured out why he had declared panelHandle as static int. There was another panelHandle declared in another file in the program. So removing the static qualifier should have actually been more problematic, as there were two panelHandle variables declared globally. Regardless, the static qualifier doesn't change the type of the variable, only the visibility (when declared outside of a function).
02-06-2012 05:27 PM
Hey Double_D,
Yes, I was mistaken in my last posting. I apologize for that. Is there anyway you can post your code? We would not expect changing the panelHandle from static int to int to solve the hanging you were seeing. As this is the case, there is probably another source of this error. Some possibilities may be:
1. Referencing the panel in a thread other than the thread that created the panel (such as discarding the panel)
2. Reassigning values to the panel in other threads.
Having your code would clarify a lot of this and help us get to the source of the problem. I look forward to hearing from you and hope that you have a great day!
Regards,
Jackie
02-08-2012 01:46 PM
The code is too large to post. I did find the panel referenced by panelHandle was discarded in another thread. What is interesting is that, after putting the static qualifier back (and with the DiscardPanel call in the separate thread still present) the problem with the LoadPanel call is gone. The return from LoadPanel seems to be consistently equal to 1 now. I think the next step may be to force the code to run on a single processor and see what happens.
02-09-2012 09:55 AM
Hi Double_D,
Please refer to the Help for DiscardPanel in CVI. It says "You must call DiscardPanel from the thread in which you create the panel." Even though you are not seeing errors related to this now, this will likely cause errors for you in the future. I would highly recommend against discarding the panel in a seperate thread from the one where you loaded it.
Regards,
Jackie