Multiple calls to Thread.start()
When i call start method (1+n) times then on the same instance of the
thread , after the first call successive calls are ignored ???
I understant that question is silly and why i want to call the run method
more than once :)) but still
how it is implemented
any ideas??
>
I understant that question is silly It's beyond silly. Here is what you asked in analogous terms.
I have decided to run across my local 12 lane highway with a blindfold on but every time I try it I end up in a coma in the hospital for 6 months. But I am compelled to do this (run across a 12 lane highway blindfolded) so how can I achieve this?
and why i want to
call the run method
more than once :)) but still
how it is implemented
any ideas??Yeah move to the red sun of Krypton. Maybe that works in reverse.
Alternatively do things the way you are supposed to do.
Similar Messages
-
Snmp commands dont work once the thread starts
I am using multi-threading. Once my thread starts executing (using the CmtScheduleThreadPoolFunction), I am not able to run simple get and set snmp function, basically they never return. Any suggestions?
Thank you all in advance.Hi qsa301,
Does your function call work without multithreading?
Is the function documented to be able to be called by multiple threads?
Here are some KnowledgeBases about CVI and multithreading:
Executing LabWindows/CVI Internet Library Functions from Multiple Threads
http://digital.ni.com/public.nsf/websearch/88AC3C540ACFE65186257021005D2084?OpenDocument
Multithreading in LabWindows/CVI
http://zone.ni.com/devzone/cda/tut/p/id/3663
General Information on Multithreading for C Programmers
http://digital.ni.com/public.nsf/websearch/6ECCBAA87476EB22862568950071CCD6?OpenDocument
Sending Parameters to a Thread Callback Function in LabWindows/CVI
http://digital.ni.com/public.nsf/websearch/A50A89929B77EE06862571BF0015F42F?OpenDocument
LabWindows/CVI and Thread Pools
http://digital.ni.com/public.nsf/websearch/F968F9F8B100393786256D25005EAF8A?OpenDocument
Gavin Fox
Systems Software
National Instruments -
Erratic behavior with multiple calls to the same RFC
Hi,
I am running into a strange problem invoking a custom RFC from a .NET application. I would appreciate it if someone has any insight into it.
The steps to call the RFC are straightforward:
1. Open the connection to SAP server
2. Make the call
3. Close the connection
As you can imagine, the code is also quite simple.
In my simulation program, I have a button on a UI form that one can click and execute the above steps.
The problem I am running into is that, on multiple calls, sometimes the parameter values that show up on the SAP side are not right. When the input parameter (a structure) is viewed in the ABAP debugger, the field values are all getting exchanged. For example, first name field contains values for the last name. Also, some fields that are supposed to have values do not have any.
Just before the RFC call is made, when we look at the structures on the .NET side, the field values are the way they are supposed to be.
I have not been able to establish a pattern. Sometimes, it takes two clicks to reproduce this problem. Sometimes it takes five.
One of the team members thinks that this starts occurring right after one call fails for some valid reasons. However, I am not yet convinced.
Having written many custom .NET applications using RFCs an BAPIs, I am fairly conversant with the technology. However, this one just baffles me. It appears something is getting messed up at the RFC layer itself. Does anyone have any idea on what could be happening?
Thank you in advance for your help.
PradeepIndeed this is interesting .
The problem is caused by an incompatible change from .NET Framework 1.1 to 2.0. Howerver, the documentation on the 1.1. API was not clear enough to decide if the incompatible change was adequate or not. Now in detail:
NCo runtime uses the reflection API Type.GetProperties to read and cache all properties of a Proxy structure. NCo assumes that the order of the returned properties is the same on each call and especially that it is the order of the properties as they appear in source code. This was the behavior in .NET 1.1. It has changed in 2.0, see e.g. the internet forum discussion in http://www.thescripts.com/forum/thread455492.html .
Calling Type.GetProperty(<PropertyName>) or Type.SetProperty(<PropertyName>) in your code moves the mentioned properties up in the list returned by Type.GetProperties() later inside of NCo.
We found the following work-arroud:
When using late-binding, call a dummy Type.GetProperties() before any GetProperty or SetProperty. -
Why are the threads start and terminate randomly?
Hi there,
I got the program below. I am wondering why are the threads start and terminate randomly? Everytime, I run the program, it produces different results.
I know that these four threads have got same normal priority (should be 5), and under windows there is something called timeslice. Then these four threads rotate using this timeslice. How do we know what exactly the timeslice is in seconds? If the timeslice is fix, then why the results are ramdom?
Thanks in advance!
* To change this template, choose Tools | Templates
* and open the template in the editor.
package mythreadone;
* @author Administrator
public class MyThreadOne implements Runnable {
String tName;
Thread t;
MyThreadOne(String threadName) {
tName = threadName;
t = new Thread(this, tName);
t.start();
public void run() {
try {
System.out.println("Thread: " + tName);
Thread.sleep(2000);
} catch (InterruptedException e) {
System.out.println("Exception: Thread "
+ tName + " interrupted");
System.out.println("Terminating thread: " + tName);
public static void main(String args[]) {
// Why are the threads start and terminate randomly?
new MyThreadOne("1");
new MyThreadOne("2");
new MyThreadOne("3");
new MyThreadOne("4");
try {
Thread.sleep(10000);
// Thread.sleep(2000);
} catch (InterruptedException e) {
System.out.println(
"Exception: Thread main interrupted.");
System.out.println(
"Terminating thread: main thread.");
1. Firstly, I set in the main function:
Thread.sleep(10000);
and I run the program it gives:
Thread: 1
Thread: 4
Thread: 2
Thread: 3
Terminating thread: 1
Terminating thread: 3
Terminating thread: 4
Terminating thread: 2
Terminating thread: main thread.
BUILD SUCCESSFUL (total time: 10 seconds)
Run it again, it gives:
Thread: 2
Thread: 4
Thread: 3
Thread: 1
Terminating thread: 2
Terminating thread: 1
Terminating thread: 3
Terminating thread: 4
Terminating thread: main thread.
BUILD SUCCESSFUL (total time: 10 seconds)
And my question was why it outputs like this? It suppose to be:
Thread: 1
Thread: 2
Thread: 3
Thread: 4
Terminating thread: 1
Terminating thread: 2
Terminating thread: 3
Terminating thread: 4
Terminating thread: main thread.
BUILD SUCCESSFUL (total time: 10 seconds)
Why these four threads start and finish randomly each time I run the program? I use Windows, suppose there is a timeslice (i.e. 1 second), these threads have the same priority. Then the threads should start and finish in turn one by one. Am I right?
2. My second question is:
When I change the codes in the 'main' function into:
Thread.sleep(10000); -> Thread.sleep(2000);
it gives me the results like:
Thread: 1
Thread: 4
Thread: 3
Thread: 2
Terminating thread: main thread.
Terminating thread: 1
Terminating thread: 4
Terminating thread: 3
Terminating thread: 2
BUILD SUCCESSFUL (total time: 2 seconds)
Run it again:
Thread: 1
Thread: 2
Thread: 3
Thread: 4
Terminating thread: 3
Terminating thread: main thread.
Terminating thread: 4
Terminating thread: 2
Terminating thread: 1
BUILD SUCCESSFUL (total time: 2 seconds)
I tried several times. The main thread always terminates before or after the first child thread finished.
My question is why it doesn't output something like:
Thread: 1
Thread: 2
Thread: 3
Thread: 4
Terminating thread: 3
Terminating thread: 4
Terminating thread: 2
Terminating thread: main thread.
Terminating thread: 1
BUILD SUCCESSFUL (total time: 2 seconds)
or
Thread: 1
Thread: 2
Thread: 3
Thread: 4
Terminating thread: 3
Terminating thread: 4
Terminating thread: 2
Terminating thread: 1
Terminating thread: main thread.
BUILD SUCCESSFUL (total time: 2 seconds)user13476736 wrote:
Yes, my machine has multi-core. Then you mean that if I got a one core machine the result should always be:
Thread: 1
Thread: 2
Thread: 3
Thread: 4
Terminating thread: 1
Terminating thread: 2
Terminating thread: 3
Terminating thread: 4
Terminating thread: main thread.
BUILD SUCCESSFUL (total time: 10 seconds)
???No.
>
How to explain my second quesiton then? Why the main thread always terminates before some of the child threads end? Thanks a lot. -
Thread start() method problem
I have a program server-client program that have a lot thread but
when I called thread.start() method it doesn't return run() method.
even so my input-output codes is running ( my client program can send data to server program )
Please help meyasinmalli wrote:
start() method doesn't call run() method of thread when I debug row to rowIt does, but the debugger will only ever follow the flow of the current thread and therefore not step into the run method. Set a breakpoint at the very beginning of your run() method and then step over the start() method, you'll see that the new thread will break exactly at that breakpoint just after start() was executed. -
Creating breakout game. Need help with thread starting.
Howdy. As the title says, I've got an assignment to make a breakout game. So far it's going alright, but I've run into a rather large snag...I can't get it to animate :P I've got my main applet, then I created a class heirarchy for the paddle, ball, and brick objects. For this question, lets just focus on the ball object.
This is my applet code so far (it is not even close to being done, so don't laugh :P )
import java.awt.*;
import javax.swing.*;
import java.util.*;
* Class BreakoutApplet - Plays a simple game of Breakout.
* @author Kris Nelson
* @version November 10, 2004
public class BreakoutApplet extends JApplet implements Runnable
protected Brick brick; // creates an object of class brick
protected Ball ball; // creates an object of class ball
protected Paddle paddle; // creates an object of class paddle
protected boolean running; // tells the program whether or not the thread is running
protected ArrayList brickArray = new ArrayList(); // stores all the bricks in the game
protected Thread timer; // the thread which controls the animation for the applet
* Called by the browser or applet viewer to inform this JApplet that it
* has been loaded into the system. It is always called before the first
* time that the start method is called.
public void init()
// this is a workaround for a security conflict with some browsers
// including some versions of Netscape & Internet Explorer which do
// not allow access to the AWT system event queue which JApplets do
// on startup to check access. May not be necessary with your browser.
JRootPane rootPane = this.getRootPane();
rootPane.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);
createBricks(); // creates the games array of bricks
ball = new Ball(400, 400, 2, 2); // sets the values for the ball
paddle = new Paddle(300, 660, 2); // sets the values for the paddle
// !!!!!!! have tried placing ball.start() here
* Paint method for applet.
* @param g the Graphics object for this applet
public void paint(Graphics g)
// draws the background, border, and all the games objects
g.setColor(Color.lightGray); // sets the drawing color to light gray
g.fillRect(0, 0, 600, 700); // displays the game screens background
displayBorder(g); // displays the game screens border
displayBricks(g); // displays the array of bricks
ball.display(g); // displays the ball
paddle.display(g); // displays the paddle
* Creates the games array of bricks
public void createBricks()
int colorNumber = 1; // starts the color of the bricks at orange
double yPosition = 100; // starts the bricks y screen position at 100
for(int i = 0; i < 4; i++)
double xPosition = 12; // starts the bricks x screen position at 12
for(int j = 0; j < 8; j++)
if(colorNumber == 0)
colorNumber = 1; // sets the color of the bricks to orange
else
colorNumber = 0; // sets the color of the bricks to green
brickArray.add(brick = new Brick(xPosition, yPosition, colorNumber)); // adds a brick to the current container in the brick array
xPosition = xPosition + brick.getWidth(); // move the bricks x screen position to the next column
yPosition = yPosition + brick.getHeight(); // moves the bricks y screen position to the next row
if(colorNumber == 0)
colorNumber = 1; // sets the color of the bricks to orange
else
colorNumber = 0; // sets the color of the bricks to green
* Displays the game screens border
* @param g the Graphics object for this applet
public void displayBorder(Graphics g)
g.setColor(Color.black); // sets the drawing color to black
g.fillRect(0, 0, 600, 24); // draws a border on the top of the screen
g.fillRect(0, 0, 12, 700); // draws a border on the left of the screen
g.fillRect(588, 0, 12, 700); // draws a border on the right of the screen
* Displays the array of bricks on the screen
* @param g the Graphics object for this applet
public void displayBricks(Graphics g)
Brick currentBrick; // holds the brick data from the current ArrayList container
for(int i = 0; i < 32; i++)
currentBrick = (Brick)(brickArray.get(i)); // grabs the brick data from the current ArrayList container
currentBrick.display(g); // displays the current brick
* Called by the browser or applet viewer to inform this JApplet that it
* should start its execution. It is called after the init method and
* each time the JApplet is revisited in a Web page.
public void start()
if(timer == null)
timer = new Thread(this); // creates a new object of type Thread
timer.start(); // starts the new thread
running = true; // tells the program that the new thread is running
* Runs the code that controls the animation
public void run()
do{
repaint(); // redraws the screen
try{
timer.sleep(100); // puts the thread to sleep for 100 milliseconds
} catch(InterruptedException e) {running = false;}
// !!!!!!! have tried placing ball.start() here
} while(running);
timer = null; // destroys the timer thread
* Called by the browser or applet viewer to inform this JApplet that
* it should stop its execution. It is called when the Web page that
* contains this JApplet has been replaced by another page, and also
* just before the JApplet is to be destroyed.
public void stop()
running = false; // tells the program that the thread is now done
}These are the bits of code for my class heirarchy, just to (hopefully) make it easier to follow.
import java.awt.*;
* The parent class of all the games objects.
* @author Kris Nelson
* @version November 9, 2004
public class Sprite
protected double screenX, screenY; // stores the x and y location of the object
* Constructor for objects of class Sprite
* @param xPosition the initial x screen position
* @param yPosition the initial y screen position
public Sprite(double xPosition, double yPosition)
screenX = xPosition; // sets the initial x screen position
screenY = yPosition; // sets the initial y screen position
* Sets new x and y screen locations for an object
* @param newX the new x screen location
* @param newY the new y screen location
public void setScreenXY(double newX, double newY)
screenX = newX; // sets the new x screen location
screenY = newY; // sets the new y screen location
* Sends back the current x screen location
* @return the current x screen location
public double getScreenX()
return screenX; // returns the current x screen location
* Sends back the current y screen location
* @return the current y screen location
public double getScreenY()
return screenY; // returns the current y screen location
import java.awt.*;
* Parent class of any game object that moves.
* @author Kris Nelson
* @version November 9, 2004
public class MovingSprite extends Sprite implements Runnable
protected double speedX, speedY; // stores the speed of an object in the x and y directions
protected Thread timer; // the thread which controls animation for all moving objects
protected boolean running; // tells the program whether or not the thread is running
* Constructor for objects of class MovingSprite
* @param xPosition the initial x screen position
* @param yPosition the initial y screen position
* @param xSpeedValue the speed in the x direction
* @param ySpeedValue the speed in the y direction
public MovingSprite(double xPosition, double yPosition, double xSpeedValue, double ySpeedValue)
super(xPosition, yPosition); // passes the initial screen positions to Sprite
speedX = xSpeedValue; // sets the speed in the x direction
speedY = ySpeedValue; // sets the speed in the y direction
* Sends back the speed in the x direction
* @return the speed in the x direction
public double getSpeedX()
return speedX; // returns the speed in the x direction
* Sends back the speed in the y direction
* @return the speed in the y direction
public double getSpeedY()
return speedY; // returns the speed in the y direction
* Starts the thread in order to start animation
public void start()
if(timer == null)
timer = new Thread(this); // creates a new object of type Thread
timer.start(); // starts the new thread
running = true; // tells the program that the new thread is running
* Empty since the child objects have their own run methods
public void run()
* Stops the thread from running
public void stop()
running = false; // tells the program that the thread is now done
import java.awt.*;
* Creates a single ball who's purpose is to bounce around and destroy the bricks.
* @author Kris Nelson
* @version November 10, 2004
public class Ball extends MovingSprite
protected static final double BALL_WIDTH = 15; // sets the width of the ball
protected static final double BALL_HEIGHT = 15; // sets the height of the ball
* Constructor for objects of class Ball
* @param xPosition the initial x screen position
* @param yPosition the initial y screen position
* @param xSpeedValue the speed in the x direction
* @param ySpeedValue the speed in the y direction
public Ball(double xPosition, double yPosition, double xSpeedValue, double ySpeedValue)
super(xPosition, yPosition, xSpeedValue, ySpeedValue); // passes the initial screen positions and ball speeds to MovingSprite
// !!!!!!!! have tried placing timer.start() here
* Displays a ball onto the screen
* @param g the Graphics object for this applet
public void display(Graphics g)
g.setColor(Color.blue); // sets the balls color
g.fillOval((int)(screenX), (int)(screenY), (int)(BALL_WIDTH), (int)(BALL_HEIGHT)); // displays the ball
* Runs the code that controls the balls animation
public void run()
do{
try{
timer.sleep(100); // puts the thread to sleep for 100 milliseconds
} catch(InterruptedException e) {running = false;}
screenX = screenX + speedX;
screenY = screenY + speedY; // this is VERY SIMPLE BALL MOVEMENT FOR TESTING PURPOSES, WILL BE CHANGED LATER
} while(running);
}Sorry if that was too much code. I'm just trying to make this easier to follow.
I placed a // !!!!!!!!!!!!! comment in the places where I have tried starting the ball thread.
So basically, everything is running fine, except that I'm not at all sure of where to start the ball Thread, and thus can't start anything moving. If someone could tell me where I should be starting the thread, I would REALLY appriciate it. Thank you :D
- KrisSome advice.
1. the start method on the ball should be called from the start method on the applet and should in turn call the start method on the sprite's thread.
2. the run method of the Moveable sprite should have been declare abstract
3. don't implement borders manually. There's a java.awt.Border class for that.
4. probably, you don't want to have the game invoke each sprite by name; just make a big list of all the sprites and invoke all of them every time
5. do you really need provision for a non-circular ball? this isn't rugby.
6. I don't think you ever had a threading problem, just a display problem.
7. Don't write comments like this: ball.display(g); // displays the ballHere's my (even more simplified version):import java.awt.*;
import javax.swing.*;
import java.util.*;
* Class BreakoutApplet - Plays a simple game of Breakout.
* @author Kris Nelson, modified by Michael Lorton
* @version November 10, 2004
public class BreakoutApplet extends JApplet implements Runnable {
protected Ball ball;
protected Paddle paddle;
public boolean running; // tells the program whether or not the thread is running
protected Thread timer; // the thread which controls the animation for the applet
public void init() {
// this is a workaround for a security conflict with some browsers
// including some versions of Netscape & Internet Explorer which do
// not allow access to the AWT system event queue which JApplets do
// on startup to check access. May not be necessary with your browser.
getRootPane().putClientProperty("defeatSystemEventQueueCheck",
Boolean.TRUE);
ball = new Ball(this, GAMEWIDTH / 2, GAMEHEIGHT / 2, 5, 5);
public final static int GAMEWIDTH = 600;
public final static int GAMEHEIGHT = 400;
public void paint(Graphics g) {
g.setColor(Color.lightGray);
g.fillRect(0, 0,
GAMEWIDTH, GAMEHEIGHT);
ball.display(g); // displays the ball
* Called by the browser or applet viewer to inform this JApplet that it
* should start its execution. It is called after the init method and
* each time the JApplet is revisited in a Web page.
public void start() {
if(timer == null) {
timer = new Thread(this); // creates a new object of type Thread
timer.start(); // starts the new thread
running = true; // tells the program that the new thread is running
ball.start();
* Runs the code that controls the animation
public void run() {
do{
repaint(); // redraws the screen
try{
Thread.sleep(100);
} catch(InterruptedException e) {running = false;}
} while(running);
public void stop() {
running = false;
abstract class Sprite {
protected double screenX, screenY; // stores the x and y location of the object
protected final BreakoutApplet parent;
* Constructor for objects of class Sprite
* @param xPosition the initial x screen position
* @param yPosition the initial y screen position
public Sprite(BreakoutApplet parent, double xPosition, double yPosition) {
this.parent = parent;
screenX = xPosition; // sets the initial x screen position
screenY = yPosition; // sets the initial y screen position
* Sets new x and y screen locations for an object
* @param newX the new x screen location
* @param newY the new y screen location
public void setScreenXY(double newX, double newY) {
screenX = newX; // sets the new x screen location
screenY = newY; // sets the new y screen location
* Sends back the current x screen location
* @return the current x screen location
public double getScreenX() {
return screenX; // returns the current x screen location
* Sends back the current y screen location
* @return the current y screen location
public double getScreenY() {
return screenY; // returns the current y screen location
abstract public void display(Graphics g);
* Parent class of any game object that moves.
* @author Kris Nelson
* @version November 9, 2004
abstract class MovingSprite extends Sprite implements Runnable {
protected double speedX, speedY; // stores the speed of an object in the x and y directions
protected Thread timer; // the thread which controls animation for all moving objects
protected boolean running; // tells the program whether or not the thread is running
* Constructor for objects of class MovingSprite
* @param xPosition the initial x screen position
* @param yPosition the initial y screen position
* @param xSpeedValue the speed in the x direction
* @param ySpeedValue the speed in the y direction
public MovingSprite(BreakoutApplet parent,
double xPosition, double yPosition,
double xSpeedValue, double ySpeedValue) {
super(parent, xPosition, yPosition);
speedX = xSpeedValue; // sets the speed in the x direction
speedY = ySpeedValue; // sets the speed in the y direction
* Starts the thread in order to start animation
public void start() {
if(timer == null) {
timer = new Thread(this); // creates a new object of type Thread
timer.start(); // starts the new thread
running = true; // tells the program that the new thread is running
* Runs the code that controls the balls animation
public void run() {
while (parent.running) {
try{
Thread.sleep(100);
} catch(InterruptedException e) {
System.err.println(e);
step();
abstract protected void step();
* Creates a single ball whose purpose is to bounce around and destroy the bricks.
* @author Kris Nelson
* @version November 10, 2004
class Ball extends MovingSprite {
protected static final int BALL_DIAMETER = 15;
* Constructor for objects of class Ball
* @param xPosition the initial x screen position
* @param yPosition the initial y screen position
* @param xSpeedValue the speed in the x direction
* @param ySpeedValue the speed in the y direction
public Ball(BreakoutApplet parent,
double xPosition, double yPosition,
double xSpeedValue, double ySpeedValue) {
super(parent, xPosition, yPosition, xSpeedValue, ySpeedValue);
* Displays a ball onto the screen
* @param g the Graphics object for this applet
public void display(Graphics g) {
g.setColor(Color.blue);
g.fillOval((int)(screenX),
(int)(screenY),
BALL_DIAMETER, BALL_DIAMETER);
protected void step() {
screenX = screenX + speedX;
if (screenX < 0) {
screenX = -screenX;
speedX = -speedX;
else if ((screenX + BALL_DIAMETER)> BreakoutApplet.GAMEWIDTH) {
screenX = 2*(BreakoutApplet.GAMEWIDTH - BALL_DIAMETER) - screenX;
speedX = -speedX;
screenY = screenY + speedY;
if (screenY < 0) {
screenY = -screenY;
speedY = -speedY;
else if ((screenY + BALL_DIAMETER) > BreakoutApplet.GAMEHEIGHT) {
screenY = 2*(BreakoutApplet.GAMEHEIGHT - BALL_DIAMETER) - screenY;
speedY = -speedY;
} -
Threads started by "Community Help"
The Adobe Community Help pages (http://help.adobe.com/en_US/illustrator/cs/using/index.html) used to have a commenting system that was specific to the help files.
Since many threads were questions, rather than additions and comments on the help files, it has been replaced by a mechanism that creates a thread in the corresponding product forum.
The threads, started by "Community Help", are titled as and linked to the community help page where the question or comment originated from, and posts are mirrored between this forum and Community help. Comments can be corrections or additions to the help files, and could be links to tutorials relevant to the help page at hand, posted on third party websites, and should therefore not be treated as spam. To keep concise and pertaining information in the help files, these discussions might be curated more closely by the moderators.
The advantages are the fact that one can now post images, videos, or links, or use advanced formatting, and the side effect is to draw on the combined expertise of all the forum posters.
The drawback is that the previous comments disappeared, but most have been saved by the Community Help Administrators.
This should be a great asset to the community, and there might be a few problems during the transition period.
For example, a "blank post" might show up which is confusing. The moderators are doing their best to delete these posts while the tech staff seems to have fixed issue.
If you have questions or remarks about these posts, please use this thread of the Forums Comments: http://forums.adobe.com/message/4172835#4172835
Thank you for your patience and understanding as this change is implemented.Martin_Zich wrote:
Hello,Hi,
I have simple question. Does anybody know how to do following. I have one thread SwingWorker and this thread is listening on serverSocket. Swing questions should be asked in the Swing forum.
When connection comes it makes new thread which looks after this connection and SwingWorker listens again. Fine, but now I want to interrupt all so I try call cancel() on SwingWorker. What happens to treads made by this SwingWorker which are still alive? Nothing
When I call this cancel what will happen to the ServerSocket. Where I have to call ssocket.close()? Catch some exception or how?An interrupted exception will be raised.
Kaj -
Calling a thread from a cvi code file to another code file
Hello,
I want to call a thread from a labwindows/cvi code file to another labwindows/cvi code file. Namely, my thread function (GraphLoop) is in 'TestsModel.c' ; but I will call the thread in 'Tests.c' . My code in 'Tests.c' is in the following;
int CVICALLBACK GraphLoop (void *functionData);
int GraphLoopId;
int callbackDataGraphLoop;
int CVICALLBACK CBBasla (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
switch (event)
case EVENT_COMMIT:
CmtInstallThreadPoolCallback (poolHandle, EVENT_TP_THREAD_BEGIN, GraphLoop, callbackDataGraphLoop, GraphLoopId);
if (tiklandiE3631ACihazinaBaglan == 0 && tiklandi34401ACihazinaBaglan == 0) // 'E3631A Cihazına Bağlan' ve '34401A Cihazına Bağlan' tuşlarına basılmamışsa uyarı verir.
MessagePopup ("Uyarı", "Lütfen cihaz bağlantısını kontrol ediniz.");
else
if (tiklandiKaydet == 0)
MessagePopup ("Uyarı", "Lütfen ayarları kaydediniz.");
else
SetCtrlAttribute (Testler, PnlTestler_BASLA, ATTR_DIMMED, 1); // 'Başla' tuşunu pasif hale getirir.
SetCtrlAttribute (Testler, PnlTestler_BASLA, ATTR_DISABLE_PANEL_THEME, 1); // 'Başla' tuşunun etiketini pasif hale getirir.
SetCtrlAttribute (Testler, PnlTestler_BITIR, ATTR_DIMMED, 0); // 'Bitir' tuşunu aktif hale getirir.
SetCtrlAttribute (Testler, PnlTestler_BITIR, ATTR_DISABLE_PANEL_THEME, 0); // 'Bitir' tuşunun etiketini aktif hale getirir.
CmtNewThreadPool (DEFAULT_THREAD_POOL_HANDLE, &poolHandle); //Yeni bir thread oluşturur.
CmtScheduleThreadPoolFunction (poolHandle, GraphLoop, NULL, &GraphLoopId); // GrapLoop thread fonksiyonunu başlatır.
break;
case EVENT_RIGHT_CLICK:
break;
return 0;
I take that errror after executing this code;
error:Undefined symbol '_GraphLoop' referenced in "f:\Tests.obj"
Please, can you help me for my question?
Regards...Hello Eren,
I assume this is a link error.
Do you have TestsModel.c file included in your project?
Constantin. -
Multiple calling logical database ADA
Hello,
I need to call logical database ADA two times in my program. I use calling logical database using LDB_PROCESS function module. I need to call LDB for depreciation areas 01 and 60. If I call second time, I get exception LDB_NOT_REENTRANT. I found, that for multiple calls of LDB, there should be LDB_PROCESS_INIT subroutine in logical database proram. In this case, program is SAPDBADA and in this program, LDB_PROCESS_INIT is missing.
Could you pls. help me, how to call ADA logical database two times?
Thanks®ards,
JirkaThe exception LDB_NOT_REENTRANT means: The logical database is not prepared to accept several successive calls within a transaction. So obviously you can't use LDB_PROCESS for your purpose.
Perhaps your goal is possible if you use a sequence of commands
GET <ldb_node_1>.
GET <ldb_node_1> LATE.
GET <ldb_node_2>.
GET <ldb_node_2> LATE.
etc...
where ldb_node_1, ldb_node_2, etc... are some nodes included in logical database ADA. As I am not familiar with this particular LDB I can't tell which nodes are required to achieve your goal. -
Hello,
I created a test report for parallel processing and this works perfectly fine but when I try to build this into a class I somehow cannot create the receiving form inside the method of the class...
method test.
CALL FUNCTION 'ZZCR_PARALLEL' STARTING NEW TASK lv_index DESTINATION IN GROUP DEFAULT
PERFORMING transfo_result ON END OF TASK
EXPORTING
input_xstring = lx_clause_text.
endmethod.
I tried to place the form before the endmethod but this doesn't work and afterwards is also not an option.
Is ABP OO not supporting parallel processing?
Thanks and regards,
ChristophHello Christo ,
I am also trying to use the same in OO context . Just in he early stages of collecting information.If you could just tell what you found out in the document it could be opf immense help.
Comradely,
K.Sibi -
Call Function'BAPI_USER_CHANGE' starting new task 'TEST'
Hi All,
I have problem with starting new task statement, I am using one FM after that am using starting new task 'TEST'
statement but its not working in one system its working fine in other systems, Please help me who this works.
Thanks in Advance.
Eg: Call Function'BAPI_USER_CHANGE' starting new task 'TEST'
RegarThanks Lqueiroz ,
Now again i am getting a DUMP by saying ,
"An error occurred when executing a REMOTE FUNCTION CALL.
It was logged under the name "At least one entry could not be "
on the called page."
so what can be the reason for this
call function 'ZRFC_PER_DIEM' starting new task lc_taskid performing subr on end of task
exporting
h_guid = it_header_guid_n
request_obj = lt_requested_objects_n.
wait up to '1' seconds.
read table gt_scl into ls_scl index 1.
p_transaction_per_diem = ls_scl-value.
read table gt_scl into ls_scl index 2.
transaction_currency_code = ls_scl-value.
form subr using task_id type clike.
data: p_transaction_per_diem type char13,
transaction_currency_code type char3.
receive results from function 'ZRFC_PER_DIEM'
tables
value = gt_scl.
So basically i am getting dumo when receive statenment is running , by giving above dump.
Regards
PG -
CALL FUNCTION func STARTING NEW TASK task
hi,
i developed rfc to extract data and send to xi
as my interface is Async
as per soem documents it was mentioned the syntax
CALL FUNCTION func STARTING NEW TASK task
wat is the task ? in the syntax
and how do i use it
jeffHi suresh,
this is the code of RFC. if i execute without RFCDESTINATION it executes successfully. when i use RFC DESTINATION it shows error
call to messaging system failed: com.sap.aii.af.ra.ms.api.DeliveryException
i created RFC destination using TCP/IP and registered program. same parameters i am mentioning in XI.
FUNCTION z_bank_reconciliation.
""Local interface:
*" IMPORTING
*" VALUE(COMP_CODE) TYPE BUKRS
*" VALUE(HOUSE_BANK) TYPE HBKID
*" VALUE(ACCOUNT_ID) TYPE HKTID
*" TABLES
*" CHQDETAILS STRUCTURE ZPAYR
DATA: itab LIKE payr OCCURS 0 WITH HEADER LINE.
DATA: jtab LIKE payr OCCURS 0 WITH HEADER LINE.
DATA: it_bank LIKE zbankrecon OCCURS 0 WITH HEADER LINE.
DATA: it_bank1 LIKE zpayr OCCURS 0 WITH HEADER LINE.
TYPES : BEGIN OF ty_bseg ,
bukrs LIKE bseg-bukrs,
hbkid LIKE bseg-hbkid,
belnr LIKE bseg-belnr,
zlsch LIKE bseg-zlsch,
kostl LIKE bseg-kostl,
hkont LIKE bseg-hkont,
bzdat LIKE bseg-bzdat,
END OF ty_bseg.
TYPES : BEGIN OF ty_t012 ,
bukrs LIKE t012-bukrs,
bankl LIKE t012-bankl,
bankn LIKE t012k-bankn,
END OF ty_t012.
TABLES : payr, t012, t012k, bseg.
DATA : itpayr LIKE zpayr OCCURS 0 WITH HEADER LINE,
itt012 TYPE STANDARD TABLE OF ty_t012,
itbseg TYPE STANDARD TABLE OF ty_bseg,
wa_itt012 TYPE ty_t012,
wa_itbseg TYPE ty_bseg,
total TYPE n.
SELECT * FROM zbankrecon INTO TABLE it_bank
FOR ALL ENTRIES IN itab
WHERE chequeno EQ itab-chect.
SELECT abukrs abankl b~bankn
INTO CORRESPONDING FIELDS OF TABLE
itt012 FROM t012 AS a
INNER JOIN t012k AS b ON bbukrs = abukrs AND b~hbkid =
house_bank AND b~hktid = account_id
WHERE abukrs = comp_code AND ahbkid = house_bank.
DELETE ADJACENT DUPLICATES FROM itt012.
SELECT zbukr hbkid hktid vblnr gjahr zaldt checf chect znme1 rwbtr
waers zaldt zbnkl FROM payr INTO CORRESPONDING FIELDS OF TABLE itpayr
WHERE ( zbukr = comp_code AND hbkid = house_bank ) AND hktid =
account_id.
SELECT bukrs hbkid belnr zlsch kostl hkont bzdat FROM bseg INTO TABLE
itbseg
WHERE bukrs = comp_code AND hbkid = house_bank.
SORT itt012 BY bankl.
SORT itbseg BY belnr.
READ TABLE itt012 INTO wa_itt012 INDEX 1.
LOOP AT itpayr.
read table itbseg into wa_itbseg with key bukrs = itpayr-zbukr
hbkid = itpayr-hbkid.
if sy-subrc = 0.
itpayr-kostl = wa_itbseg-kostl.
itpayr-hkont = wa_itbseg-hkont.
itpayr-bldat = wa_itbseg-bzdat.
itpayr-zlsch = wa_itbseg-zlsch.
endif.
itpayr-zbnkl = wa_itt012-bankl.
itpayr-zbnkn = wa_itt012-bankn.
MODIFY itpayr.
APPEND itpayr TO chqdetails.
ENDLOOP.
LOOP AT chqdetails.
READ TABLE it_bank WITH KEY chequeno = chqdetails-chect.
IF sy-subrc NE 0.
MOVE chqdetails TO it_bank1.
APPEND it_bank1.
CLEAR it_bank1.
ENDIF.
ENDLOOP.
REFRESH chqdetails.
chqdetails[] = it_bank1[].
LOOP AT it_bank1.
MOVE : it_bank1-chect TO zbankrecon-chequeno,
sy-datum TO zbankrecon-check_date,
sy-uzeit TO zbankrecon-check_time.
INSERT zbankrecon.
CLEAR zbankrecon.
ENDLOOP.
ENDFUNCTION. -
CALL FUNCTION WITH STARTING NEW TASK
Hi All,
i'm call a function module through
CALL FUNCTION 'Y_WIN' DESTINATION 'rfc_destination' then it's give right result but when i want to call with starting new task then
CALL FUNCTION 'Y_WIN' STARTING NEW TASK 'INFO' DESTINATION 'rfc_destination'
it does nt provide me any data. i have check in debugger call fm is wkging fine so pls clear me why i'm nt geeting result.
pls give ur suggestions,
AnujDid you use the PERFORMING <form> ON END OF TASK to get the results back; like in the following sample
CALL FUNCTION 'SAPWL_STATREC_READ_FILE'
STARTING NEW TASK taskname
DESTINATION list-name
PERFORMING read_outtab ON END OF TASK
EXPORTING
read_start_date = s_date
read_start_time = '000000'
read_end_date = s_date
read_end_time = '235959'
EXCEPTIONS " failure when calling RFC
communication_failure = 1 MESSAGE msg_text
system_failure = 2 MESSAGE msg_text
RESOURCE_FAILURE = 3.
and
FORM read_outtab USING taskname.
* Receive results back
RECEIVE RESULTS FROM FUNCTION 'SAPWL_STATREC_READ_FILE'
TABLES
v2_normal_records = outtab
EXCEPTIONS " from the called FM
nodata = 1.
Regards -
How do I prevent multiple applications opening on start up with Lion?
how do I prevent multiple applications opening on start up with Lion?
It's the Resume feature of Lion:
Managing Mac OS X Lion's application resume feature.
If you shutdown your computer you should get a dialog asking if you want applications to resume on the next startup. Simply uncheck the box to prevent that from occurring. Open General preferences and uncheck the option to Restore windows when quitting and re-opening apps. You can also install a third-party utility to control resume features on individual applications: RestoreMeNot or Application State Cleaner. -
Multiple call of update function module
Hi Everybody,
I have made implementation to the definition MB_DOCUMENT_BADI( material Document creation).
While executing this BADI I am getting short dum with this error Multiple call of update function module.
Here is the short dump--
In the FORM routine Buchen_Ausfuehren (program SAPMM07M), an error
message was issued by a Business Add-In (BAdI) or function module.
This is not permitted, because it could lead to data
inconsistencies. For this reason, the update of the material
document was also terminated with a termination message (dump).
Note that this message (M7 372) is not the responsible error
message.
Please any body suggest the way forward.
Regards,
Sandeep.Hi Kiran,
Thanks for the reply.
I have created one implementation to the BADI MB_DOCUMENT_BADI. This badi will hit while creation of material document.I have write the code in method MB_DOCUMENT_BEFORE_UPDATE such that it will act only for certain movement types specially for t-codeMb1a and MB31.
What problem I am facing i have used a error message "MB_DOCUMENT_BEFORE_UPDATE" in this method.If we got the erroe message then we dont need to post the material dcoument,but here problem is that if the material document could not posted then it corrupt the material and when we performing 261/101 we got error message like " Inconsistency between MM and ML for material and plant"
I have used following things like-
1-while updating the customized table using " Commit Work".
2-Call function vb_change_batch for updating the batch and not in update task.
3. Dequeue the table after updating the table.
Will thos things can create any inconsistency to the MM and ML.
Please suggest me uor thoughts.
Thanks
sandeep.
Thanks ,
sandeep.
Maybe you are looking for
-
Adobe Photoshop elements7.0 (Organizer) error, windows 7
Hi! I'm getting a "adobe Photoshop Elements 7.0 (Organizer) has stopped working error". I seached the knowledgbase and found fixes for previous windows versions but not windows 7. I tried searching for similar files to no avail. Customer service w
-
I am trying to wirelessly connect a smart tv to my laptop
te smart tv isasking for WAP2 passphrase the only one i know is he WAP where do i find the WAP2 passphrase
-
ISight not working from one user account on MacBook
Hi everyone, It'd be great to get some help with fixing an iSight camera. I've followed the instructions here: http://support.apple.com/kb/HT2090 and have narrowed it down to a particular user account (it has admin permissions). Other user accounts c
-
Hello programmers. I am writing a very simple program. I want the user to specify a workout activity and then plan it for a certain day of the week. I cannot figure out how to create a new instance of Calendar to set it for the day of the week specif
-
HT1366 What size are the two audio ports on an older model MacBook, not MBP?
What size are the two audio ports on an older model MacBook, not MBP?