How to run VI in new thread
How can I run my labVIEW VI in a new thread without having to restart LabVIEW every time before I run?
You can also load the VI through the VI Server. Since the data flow is avoided, and the VI is essentially loaded as external code, it gets it's own thread as far as I know.
When doing this, setting the Property "Wait until finished" to false is quite useful too.
Hope this helps.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
Attachments:
Vi server.png 16 KB
Similar Messages
-
Hi!
I', m working with TestStand Version 4.2.1. I have a main sequence, which calkls different subsequences. All these steps are properly reported. One of subsequences runs as "new thread". How can I include its results in common test report of the main sequence?
I have markes variables of the subsequence as it is requred for test report (it works OK if it is not a new thread). If the the numerical test, which is executed in this subsequence is correct, I get no results at all. If the numeric test failed I get somewhere in the main sequence report a "red message", that test failed whithout any reference to the step or values of vaiables which were not correct.
I tried an option "On the fly" in the Report Configuration , but haven' got any useful results. What shall I do?
Best regards
Solved!
Go to Solution.Hi,
I tried it but without success:
1) I got a reference to the Thread as "Locals.Step1=RunState.Thread" for every of 2 steps which start a thread
2) I put both "Waits" after steps with (and without) threads, at the same place, where they were before
3) The sequence run OK, but when it came to Wait for Thread 1 it waited for ever, I had to terminate sequence
Does it mean, that I got a false reference (suppose No - please, have a look at attached pic)?
Or does it mean, that Waits are badly placed in the sequence (threads are already terminated)? Here is a pic of sequeces calls with Wait after them.
Regards
Attachments:
Thread.JPG 34 KB
SequenceCall.JPG 32 KB -
How can I create a new thread to run PulseOutput.VI
Hi:
I use NI-94729(cDAQ system) to generate pluse and want to output pulse continuously and to check the pulse is 500Hz.
In TestStand, the steps as follow:
1: Call PulseOuput.vi to generate 500Hz pulse, VI use Finite Mode to generate pulse.
2: Verify the pulse is 500Hz.
Howerver, after the first step finishes, the pulse output stops, te 2nd step is failed. If a Continuous Mode is used in PulseOuput.vi to generate pluse, the 1st step can't finish.
Thanks a lot!Hello MotionBoy,
There are two ways to go about creating a new thread to run a step. The first is to create a new sequence, into which you put the LabVIEW step you want to run and any other steps that may go along with it. Then use a sequence call step to call this newly created sequence. Set the Execution Options of the Sequence call step to 'Use New Thread.' This will allow you to run a set of steps in a new thread, not just a VI. The second method, which is only available for a LabVIEW VI, is to use the “Run VI Asynchronously” step. This can be accessed if you right-click within your sequence and select Insert Step » LabVIEW Utility » Run VI Asynchronously. This step will allow you to call a VI and have it automatically open in a new thread. You can further customize this step by opening the configuration menu in the Step Settings.
To address the current behavior of your steps I would like to know if the modules in steps 1 & 2 pass data between them or it would be desirable for them to do so? If so you are going to need a more complex synchronization structure such as TestStand/LabVIEW queues. There is a simple example you may want to look at in the TestStand examples, under the Synchronization folder that demonstrates how to use queues. Otherwise the above solution should be all you need.
John B.
Applications Engineer
National Instruments -
Java Thread : How to run a method using Thread
hi,
I have a method which i need to run with thread. Is there any way to do that. I have a code like below
public class parentClass extends Thread{
public static void main(String[] args){
ThreadClass threadClass = new ThreadClass()
Thread th = new Thread(threadClass.threadMethod("sample message"));
th.start();
System.out.println("Finished Threading");
public class ThreadClass(){
public threadMethod(String arg){
System.out.pritnln("Message received "+arg);
}thankQYou really seem very confused about alot of things.
If the code in your first posted code block compiled then it would have two threads. Not the one you said. But neither that example nor your follow up
are really making any sense. Statements like
//The main idea is it(childMethod()) will take lot of time for some arguments less time for some arguments.
// So that it will clear and can be available for other thread.indicate to me that you don't understand how threading works or what it is for.
Please start by reviewing the [_Concurrency tutorial_|http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html]
Perhaps on completing that tutorial you may be able to formulate a question which can actually be answered. -
How to run setup for new datasources without breaking old datasources?
Hi,
I am wondering how to install some more data sources (2LIS_05_Q0NOTIF, 2LIS_17_10NOTIF and 2LIS_18_10NOTIF) without breaking the delta mechanism for other data sources when I start to use the new datasources.
I have installed some QM cubes (0QM_C04, -05, -08 and -11) and delta loads run every night. Now I want to add two more cubes (0QM_C02 and -03). The new cubes use datasources that are not yet available.
If I now activate the needed datasources, delete the content of the setup tables again and run 'Application-Specific Setup of Statistical Data' for 'Quality Management', 'Plant Maintenance' and 'Service Management', I am afraid that I will re-initialize the delta queue for the datasources that are already in use... In other words: I am afraid of breaking all datasources in application 05, 17 and 18...
I cannot find documentation addressing this problem. Any input, anyone?
Best regards,
Christian FrierHi all,
if I understand you all correctly, I can use the following plan:
0) Wait until no documents are posted on the R/3 side.
1) Run the delta loads and check that the queues are empty (RSA7 and LBWQ).
2) Delete the setup tables.
3) Run the 'Application-Specific Setup of Statistical Data'
4) Create and execute infopackages for initial dataload (for the new datasources).
5) Create and execute infopackages for delta loads (for the new datasources).
6) Run the infopackages for delta load from the 'old' datasources without running a new initial dataload.
So basically 6) is the step I worry about.
That is that I can start to use 2LIS_05_ITEM, 2LIS_17_ITEM and 2LIS_18_ITEM without breaking the delta sequence for 2LIS_05_TASK, 2LIS_17_TASK and 2LIS_18_TASK.
regards,
Christian -
hello, I'm sure this is a simple question answered before, but I'm really confused. I have a Mac OS X version 10.5.8 and cant run icloud or my new iPhone. I think that I need to pay to download new software, but what exactly do I need? I don't want to spend a fortune unecessarily and I don"t want to download anything that will screw up the laptop or not work....
Start by checking if you can run Snow Leopard:
Requirements for OS X 10.6 'Snow Leopard'
http://support.apple.com/kb/SP575
Whilst Apple have withdrawn Snow Leopard from their stores, you can still get it from Apple by calling 1-800-MY-APPLE (if you are in the USA) and they will supply the SL DVD for $20 for a single user, or $30 for a family pack that covers up to 5 Macs. You can also purchase the code to use to download Lion from the same number (Lion requires an Intel-based Mac with a Core 2 Duo, i3, i5, i7 or Xeon processor and 2GB of RAM, running the latest version of Snow Leopard), or you can purchase Mountain Lion from the App Store - if you can run that:
http://www.apple.com/osx/specs/
If you are outside the US call your national Apple Helpline:
http://support.apple.com/kb/HE57
If you're in the UK, use this number: 0871 508 4400
When you have installed it, run Software Update to download and install the latest updates for Snow Leopard.
To use iCloud you have to upgrade all the way to Mountain Lion:
http://support.apple.com/kb/HT4759 -
How do I turn off new threaded SMS messaging in OS 5.0?
I upgraded to v5.0.0.328 but now all of my SMS & MMS messages are combined into long threads according to the incoming phone # or short code. That's all well & good if the messages were coming from separate phone #'s so they'd be in separate threads but the issue here is that Verizon Wireless uses the same short codes for many of it's own customer-set alerts from the My Verizon website. For example, my 2 daily horoscopes, my 2 daily stock alerts, & all of my sport team score alerts all get sent using short code 1111.
So now in my SMS/MMS Inbox, I only see 1 listing from 1111, but when I open the subject, I get half of my screen filled w/ the keyboard automatically & now have 45 messages all on 1 screen because they're all from 1111.
I can't find in any option menu a way to turn both the threaded functionality off & to stop having the keyboard pop automatically.
Help please!I'm sorry I couldnt last any longer I actually downgraded back to the old OS
Heres my test.
I sent myself a text message
Received it
Sent another
Received it
If you choose delete, it will delete all messages, including the outbox. That is one feature i do not like. I like having the power to delete which messages I want
But thats even beside the point
So check this out
I sent myself a message
received i
sent another (#2)
received it
sent a third one
received it
yet for some odd reason it decided to send TWO more; I was like; what the heck
But besides this text message problem, my storm has frozen up on me on a few applications and then the screen goes completely black, and no matter what key i press, the system stays black, so I press and press and press and press til finally something pops up then it takes forever to log out................/sigh -
How can I include the results are coming from a new thread, in the main sequence report?
Hi,
I have a main sequence which calls other sequence running in a new thread.
I cannot see the results (limit test etc.) comming from that sequence.
Is there any trick to it?
AndrasHi again Andras.
I got a reply from the technical support. I hope this help you.
To include in main report the results of your test in another thread you must follow these steps:
1.- Right click on the sequence call where you create the new thread. In "Specify Module" panel, just right "Run sequence in a new thread" press "Settings" button and disable "Automatically wait for the thread to complete..."
2.- At the end of your main sequence add a new "synchronization - wait" step. Configure your wait, selecting in the upper ring tab "wait for thread".
3.- Then select below "specify by sequence call" and pick over your thread name.
With these changes your main sequence will add the results from your thread to your main sequence report.
I hope it works for you. (but sadly it doesn't work for me) -
Calling a Function in new thread
Hi,
I am New to java, i wrote a class it has some functions ,now i want to call one of its function in from another of its methods in new thread, how can i do it.
Scenario is :
Classs A extends thread
function One()
Thread new = new Thread(functionTwo());
Function Tow()
but it i snot allowing me to call that functionNaseerqau wrote:
I am New to java, i wrote a class it has some functions methods,
now i want to call one of its function methods in from another of its methods in new thread, how can i do it.This demonstrates how you run something in a thread.
I am guessing any Java tutorial on threads will have something like it.
class Naseergau {
Naseergau() {}
void method1() throws Exception {
for(int i=1;i<10;++i) {
System.out.println("In method1()");
Thread.sleep(20L);
void method2() throws Exception {
for(int i=1;i<10;++i) {
System.out.println("In method2()");
Thread.sleep(20L);
public void runSerial() {
System.out.println("Start runSerial");
try {
method1();
method2();
} catch (Exception ex) {
ex.printStackTrace();
System.out.println("End runSerial");
public void runParallel() {
System.out.println("Start runParallel");
Thread t1 = new Thread(new Runnable() {
public void run() {
try {
method1();
} catch (Exception ex) {
ex.printStackTrace();
t1.start();
Thread t2 = new Thread(new Runnable() {
public void run() {
try {
method2();
} catch (Exception ex) {
ex.printStackTrace();
t2.start();
try {
t1.join();
t2.join();
} catch (Exception ex) {
ex.printStackTrace();
System.out.println("End runParallel");
public static void main(String[] arg) {
Naseergau n = new Naseergau();
n.runSerial();
n.runParallel();
} -
Start a new thread from JSP ???
suppose my JSP code is like this,
<%
Obj.heavyProcess();
%>
How can I start a new thread to do
out.println(" ");
out.flush("");
while the heavyProcess is going on? I need to do this because my ISP will cut any Idle connection after certain time and my heavyProcess takes a long time to finish.
for certain reasons, I can not do waiting page, refreshing, etc.The same way as you would from a normal java application. Write your thread class
package com.yourpkg;
public class YourHeavyProcess implements Runnable{
private YourObject obj;
public YourHeavyProcess(YourObject obj){
this.obj = obj;
public void run(){
obj.heavyProcess();
}and create and invoke this thread from your jsp.
<%
YourObject obj = new YourObject();
Thread t = new Thread(new YourHeavyProcess(obj));
t.start();
%>
out.println()..;
out.flush()....;Note that the thread cannot write anything to the output stream as the response is over and done with. It can only perform backend tasks (like data archival for instance)
You could consider using a Timer and a TimerTask class which provides a slightly higher abstraction layer over threads . Look at [url http://forum.java.sun.com/thread.jspa?threadID=758874]this post (reply 48) for an example.
And finally you wouldnt want a large number of threads to be generated and competing for cpu time on your web server (whose primary responsibility is to receive http requests and send responses). You can use a thread pool to manage the number of threads spawned by your application. If you use java5, take a look at the [url http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/Executors.html]java.util.concurrent.Executor class for thread pool implementations that you can use off the shelf.
cheers,
ram. -
Step as new execution or new thread
is there is a way to make a single step to run as a new Thread or execution . ?
or it could be only done through a Seq Call(which runs as a separate sequence thread )Hi Aparab,
Except for Run VI Asynchronously step, which can run a LabVIEW code module in new thread, there is no option provided for running individual steps in a new thread or execution.
-Needhi -
How to let new thread to access EJB
I start new thread in Servlet class and I want this thread to call EJB business method but I get following error:
javax.naming.NameNotFoundException: Name comp/env/ejb not found in context "java:"
Probablly because thread has no credentials and so on. I know this concept violates J2EE specs but I don't know how to make timer to call business mathod every N minutes (I use J2EE 1.3 so I can't use Tiemr EJB).
I suspect that this new thread has no credentials and no role. What happens if I set run-as some role in servlet? As I saw new thread still has no credentials and role.
Can anyone suggest me how can I set credentials to new thread so it can call EJB business method or how to implement timer service in J2EE 1.3.I start new thread in Servlet class and I want this
thread to call EJB business method but I get
following error:
javax.naming.NameNotFoundException: Name comp/env/ejb
not found in context "java:"It may happen because you'r new thread doesnt have information (JNDI environment) about EJB references.
Can anyone suggest me how can I set credentials to
new thread I guess it's server specific.
so it can call EJB business method or how
to implement timer service in J2EE 1.3.Don't use EJB reference. Lookup EJB by it's global JNDI name. -
How can I create a new Question thread?
How to create a new "Question Thread" regarding the account payment ?
Hello MotionBoy,
There are two ways to go about creating a new thread to run a step. The first is to create a new sequence, into which you put the LabVIEW step you want to run and any other steps that may go along with it. Then use a sequence call step to call this newly created sequence. Set the Execution Options of the Sequence call step to 'Use New Thread.' This will allow you to run a set of steps in a new thread, not just a VI. The second method, which is only available for a LabVIEW VI, is to use the “Run VI Asynchronously” step. This can be accessed if you right-click within your sequence and select Insert Step » LabVIEW Utility » Run VI Asynchronously. This step will allow you to call a VI and have it automatically open in a new thread. You can further customize this step by opening the configuration menu in the Step Settings.
To address the current behavior of your steps I would like to know if the modules in steps 1 & 2 pass data between them or it would be desirable for them to do so? If so you are going to need a more complex synchronization structure such as TestStand/LabVIEW queues. There is a simple example you may want to look at in the TestStand examples, under the Synchronization folder that demonstrates how to use queues. Otherwise the above solution should be all you need.
John B.
Applications Engineer
National Instruments -
URGENT: How to run threads in sequence?
Dear experts, I am new to writing threads. I would like to know how to run threads in sequence? How do I know when a thread finishes its task?
In the following code, classes Process_A(), Process_B(), Process_C() and Process_D() are subclasses of Class Thread.
I'd like to know if I am using the join() function correctly? My intention is to wait for the previous process to finish before running the current process.
Could anyone kindly give me some solutions on how to run the processes in sequence?
Thanks!!
=============================================================
Thread process;
Vector process_names = new Vector();
process_names.add("a");
process_names.add("b");
process_names.add("c");
for(int i=0; i<process_names.size(); i++)
String process_name = (String) process_names.elementAt(i);
if(process_name.equals("a"))
process = new Process_A();
else if(process_name.equals("b"))
process = new Process_B();
else if(process_name.equals("c"))
process = new Process_C();
else if(process_name.equals("d"))
process = new Process_D();
timer = new javax.swing.Timer(1000, new ProcessListener());
timer.start();
// ProcessListener()
class ProcessListener implements ActionListener {
public void actionPerformed(ActionEvent evt) {
if(process!=null)
if(process.isAlive())
try
process.join();
catch(Exception ex)
ex.printStackTrace();
process.start();just look at this simple example u will get to know how to use join method
This does exactly what u want
class callme
void call(String msg)
System.out.println("["+msg);
Try
Thread.sleep(1000);
catch(InterruptedException e)
System.out.println("interrupted");
System.out.println("]");
class caller implements Runnable
String msg;
Callme target;
Thread t;
Public Caller(Callme targ, String s)
target=targ;
msg=s;
t=new Thread(this);
t.start();
public void run()
target.call9msg);
class Synch
public static void main(String arg[])
Callme target=new Callme();
Caller ob1=new Caller(target,"hello");
Caller ob2=new Caller(target,"Synchronized");
Caller ob3=new Caller(target,"world");
Try
ob1.t.join();
ob2.t.join();
ob3.t.join();
catch(InterruptedException e)
System.out.println("interrupted");
waiting for dukes -
How to run two threads simultaneously ....?
Hello All,
I Am developing an application which send some data to server and from remote place that data is fetched and displayed.
For this i am using Java Servlet as a server which accepts data by readObject() method of object output stream and writes using writeObject() method.
At remote end i am fetching the data and printing that using thread.Data is fetched using URL's method
URL urlServlet = new URL("URL of servlet");
URLConnection con = urlServlet.openConnection();But while fetching it takes some time say 1-2sec because of that my display is not continuous.
I want to write an application such that two threads will be running(in synchronization),second thread will start after few ms of 1st thread.One thread will continuously fetches data and other will display, so that there will be no delay at all while displaying of data.
How to do this?
Thanks In Advance.Google on: java producer consumer example
Kaj
Maybe you are looking for
-
Error , ORA-19809 & ORA-19804 While restoring RMAN backup .
Hi Experts, I am restoring production RMAN backup to UAT . Using below steps 1)rman target=/ 2)RMAN> startup nomount; 3) RMAN> restore controlfile from '/orabkdump/Rman_Bak/ACME/bkup_CTLFL_2206101206.ctl'; Starting restore at 05-AUG-10 using target d
-
Firefox Display Distorted with Mac 10.8.2 and FF 15.0.1
I recently updated my OS from S.L to M.L. (10.8.2) and in doing so my firefox 15.0.1 will not allow me to extend the size of my browser window on my 27' iMac much more then a window of about 8"x8" or everything distorts and I can no longer type in an
-
I uninstalled Adobe Acrobat Pro due to Windows 8 malfunction with starting up. I am trying to reinstall as I am an owner of the Creative Suite CS6 and I cannot access my serial number. I purchased the software in 2013 and never registered i, apparent
-
JDBC Lookup in message mapping
Hi Folks, in a message-mapping i use a jdbc lookup. i get this error, can anybody help me ? Put value [Plain exception:Problem when calling an adapter by using communication channel JDBC_MKA_Receiver_Lookup (Party: , Service: R3EREDATA, Object ID: 3a
-
Error in Part1 entry for Direct consumption.
Hai all MM gurus, Generally in Std SAP, the system will create a single material document for the goods receipt and issue for the direct consumption procurement. From this material document it generates two Part I entries for register RG 23 C, one f