Make 2 methods run at exactly the same time

Hi,
How can I make 2 mothds be executed at exactly the same time? Is it anything to do with the synchronized keywor?
Thanks.

You can't really.
Even in the case of two computers, you probably don't have control over how the OS will give Java CPU cycles, so even though you thing you're clicking at the same time, the methods may start at slightly different times.
Similarly , on a multi-CPU machine, you don't generally control how threads are apportioned among the CPUs, or when they get time.
How exact does "exactly" need to be? +/- 1 μs? +/- 1 ms? 100 ms?
Why do you need this?
Why do you think you need this? There may be another ay to acommplish your ultimate goal without needing two methods to start simultaneously, or close to it.

Similar Messages

  • How to make two PCs (one local, one remote) control the same running vi at the same time?

    Hi Labviewers,
    I have a vi running, and two PCs are monitoring it, one is local and another one is remote.
    I can see the remote front panel at the remote machine by using application property node, but it seems only one of the two PCs has the control of the running VI at the same time.
    Is there any way to make the two PCs both have the control of the same vi at the same time?  Switching back and forth the control between two PCs is really annoying.
    Thanks a lot for any help.
    Anne

    What exactly are you trying to control?
    Perhaps another approach? You could use "Shared Variables" from LV 8.0 and have a copy of the writer VI on each of the control PCs edit the value on the host PC. But as soon as I post, someone is going to talk about multiple writers to shared resources being a bad idea.... so just be careful or you may try to edit a value that has already been changed.
    Matt Holt
    Certified LabVIEW Architect

  • How to update 2 TransformGroup at exactly the same time?

    Hi all,
    In my 3D scene, I would like to apply transformation to my shapes at the same time that my eye point is moving; for example, just like in car racing games where your car is always visible in front of you, and your eye point and lookAt point change as the car moves.
    As a beginner to 3D programming, I've chosen the following approach. My first TransformGroup has the Transform3D object on which I'll called the lookAt method. This takes care of changing the eye point. My second TransformGroup has the shapes for the car as its child. Both TransformGroup objects are added to the root node of my scene graph.
    While both TransformGroup have the ALLOW_TRANSFORM_WRITE capabilities set, I launched another thread to call the setTrasform methods on the 2 TransformGroup objects at regular intervals.
    This seems to be working in terms of translating my objects and eye point, but I see noticable flickers. I suspect that's because for any given frame, the two setTransform calls to the two TransformGroup objects don't happen at exactly the same time. Do you think that is the problem?
    Please let me know of any other approach to this problem.
    Thanks in advance.

    Use the Behavior framework for making changes in the scene. This uses an internal j3d thread which is in sync with the rendering thread.
    See chapter 4 (Interaction) and 5 (Animation) in the 2nd module of the j3d tutorial (this may not be the correct chapters, since i have a rather old version of the tutorial)

  • Can I Make 2 Remote Calls at the Same Time?

    Hi,
    Can I make 2 remote calls at the same time? For example, if I have the following remote objects:
    <mx:RemoteObject id="myRemote" destination="zend" source="MyData" showBusyCursor="true" fault="faultListener(event)">
         <mx:method name="getData" result="getDataListener(event)"/>
    </mx:RemoteObject>
    <mx:RemoteObject id="myRemote2" destination="zend" source="MyData2" showBusyCursor="true" fault="faultListener(event)">
         <mx:method name="getData2" result="getDataListener(event)"/>
    </mx:RemoteObject>
    And I call them at the same time:
    public function myFunction():void {
         myRemote.getData();
         myRemote2.getData2();
    Will it work? Will Flex "confuse" the results of one call with the results of the other call? Do I need an AsyncToken? If so, how do I use an AsyncToken in the above example?
    Thank you,
    -Laxmidi

    I do this all the time. I call one for the combobox that has a list of the people, a
    and another with that data about the people filling a datagrid. Then use the combobox to filter the datagrid.
    In your sample though mak another  result="getDataListener(event)" and name it getDataListener2, so there is a dataprovider for the first and a seperat for the second.
    If your going to the same event the second one will replace the first one.
    Hope this helps

  • Getting two midi threads to start at exactly the same time

    Hello, is it possible to get two threads to start at exactly the same time because when I start two threads or more at the same time that playback midi using a synthesizer, they never start at exactly the same time.
    Any help would be appreciated.

    Use the Behavior framework for making changes in the scene. This uses an internal j3d thread which is in sync with the rendering thread.
    See chapter 4 (Interaction) and 5 (Animation) in the 2nd module of the j3d tutorial (this may not be the correct chapters, since i have a rather old version of the tutorial)

  • Prevent Jobs Running Twice at the same time

    Hi all, I would like to know if they are any ways to prevent a release job to run twice at the same time. For exemple, if  I create a job to run every 5 minutes and the job did not finish after 5 minutes, the scheduler will start the same job agains.  This situation causing us bad issues.
    I double check the job start conditions in sm37 but I found nothing special.
    Thanks for help

    Hi Marc,
    We use a workaround. We have asked our abap developpers to write a small utility report which checks if the job it is part of is already running and aborts the job if it is the case.
    When we need a job which must absolutely run only once at the same time, we just add this utility as first step.
    Regards,
    Olivier

  • How to make 2 balls move at the same time

    I am working on an app in xcode and I need to make 2 balls move at the same time. When I try to use the same code for both of the balls, the 2 CGPoints interfere. Here is my code in the .m file.
    @synthesize ball, ball2;
    -(void) onTimer {
            ball.center = CGPointMake(ball.center.x+pos.x,ball.center.y+pos.y);
            if(ball.center.x > 295 || ball.center.x < 10)
                pos.x = -pos.x;
            if(ball.center.y > 435 || ball.center.y < 35)
                pos.y = -pos.y;
    - (void) onTimer2 {
    ball2.center = CGPointMake(ball2.center.x+pos.x,ball2.center.y+pos.y);
    if(ball2.center.x > 295 || ball2.center.x < 10)
    pos.x = -pos.x;
    if(ball2.center.y > 435 || ball2.center.y < 35)
    pos.y = -pos.y;
    [self collision];
    - (void)viewDidLoad
              [[NSTimer scheduledTimerWithTimeInterval:0.04 target:self selector:@selector(onTimer) userInfo:nil repeats:YES] retain];
        [[NSTimer scheduledTimerWithTimeInterval:0.04 target:self selector:@selector(onTimer2) userInfo:nil repeats:YES] retain];
        [super viewDidLoad];
        // Do any additional setup after loading the view from its nib.
    Here is my .h file
    @interface game : UIViewController {
        IBOutlet UIImageView *ball;
        IBOutlet UIImageView *ball2;
    @property(nonatomic,retain) IBOutlet UIImageView *ball;
    @property(nonatomic,retain) IBOutlet UIImageView *ball2;

    What do you mean by the 2 CGPoints interfere?
    You're changing the location of the balls by pos.x and pos.y, where is the code for those? what is it doing?
    Why have two timers?  One timer would work , just have the code move both balls.
    The refresh rate for the screen is 60hz. (60 time a second) You'll get better animation if you stick as close to this value as you can.

  • HT2905 i want to delete dublicates with exactly the same time, advice?

    i want to delete dublicates which show exactly the same time, any advice?
    anybody any idea how to fix this?
    i have 1600+ duplicates with exactly the same problem so deleting each number will take me ages.
    any free program or function in itunes you can use?

    Hold down ths shift key then highlight the first of the group and then the last of the group.
    If the files are not in order hold down the command key and then select them one at a time in any order.

  • Multiple running queries at the same time

    Hi!
    I looked around (and RTM) for this but didn't find anything, so I'm asking here.
    I have quite a few long running queries (data loading and such things, warehousing stuff), and I need to be able to run multiple queries/statements at the same time. In TOAD I can do this, start a procedure and while it is running I can do SQL statements in another session tab (it supports threaded sessions - it starts queries in their own background thread/session).
    When I start a long running procedure or query in SQL Developer I can not do anything until the procedure execution finishes. Is there any way (setting/preference) to enable SQL Developer to be able to run multiple queries at the same time?
    I really would like to move away from TOAD, but this is a major showstopper for me.
    Thanx for any tips.
    Alex

    Hi!
    This post is going to be a little longer, but I have to clarify things out.
    I did not mean to throw any wild accusations, because I did my fair share of RTFM and searching the help. I can tell you that if you put any of these in the help search box:
    session
    non shared
    non-shared
    connection
    concurrent <- I guess this one should yeld something
    multiple
    spawn
    you won't find anything usefull, the article that comes closest, is this:
    "Sharing of Connections
    By default, each connection in SQL Developer is shared when possible. For example, if you open a table in the Connections navigator and two SQL Worksheets using the same connection, all three panes use one shared connection to the database. In this example, a commit operation in one SQL Worksheet commits across all three panes. If you want a dedicated session, you must duplicate your connection and give it another name. Sessions are shared by name, not connection information, so this new connection will be kept separate from the original."
    It does not mention any spawning of non-shared connections from the current one, nor it does mention using a accelerator key combo. But since there could be written something about it, I guess you could call it a documentation bug, because it does not provide any clue to this functionality. The help is definitely of no help in this case. As you can see, I do not throw accusations without trying to find out something first. I guess if someone is not as deep into SQL Developer as you are, there is no way for him/her to know this.
    OK, I tried your suggestion, and (sadly) it does not work as I suppose it should.
    Here's what I did:
    - start a new connection, and enter the following code in SQL Worksheet:
    declare
    j number;
    begin
    for i in 1..1000000
    LOOP
    j := sin(i);
    end LOOP;
    end;
    As you can see, it doesn't do much besides holding the connection busy for a while when executed.
    - start a new non-shared connection from the first one using CTRL-SHIFT-N (as you suggested) and put the following statement in the new SQL Worksheet (with "__1" appended to connection name)
    select sysdate from dual;
    - go to the first SQL Worksheet and execute the procedure
    - while the procedure is executing, go to the second SQL Worksheet and hit F9.
    The sysdate is returned as soon as the first SQL Worksheet finishes and not any sooner. It may run in separate session, but the result is not returned before the other session is finished doing what it is doing. I guess the correct behaviour would be to return the sysdate immediately.
    I verified this behaviour repeating it 3 times starting with a new instance of SQL Developer, each time connecting to another schema and spawning the new non-shared session. The database used was Oracle 10.2.0.3 EE on RHEL 4 UPD3.
    The concurrent execution lacks concurrency. The statements might be executed concurently on the database (i did not went the extra mile to verfiy this), but the returning of results is just not independent of other sessions. To the end user this is as much concurrent as it is serial execution.
    I hope developers get this issue straightened out soon, as I said, I'd love to move away from Toad, but I'll have to wait until they fix this out.
    Is there anything else that can be done to make it behave correctly?
    Kind regards
    Alex

  • Two macs running garageband at the same time

    Hi. I am using GarageBand on two Mac's at the same time and would like to know how I can record both parts of the tracks, I guess I'll have to use an external recording device of some sort but I do not know which or how I would set this up. Basically, I am playing a part of the song on one Mac and the other part on the other Mac and would like the two Mac's to be liked up to a seperate recording system so I can record the mix, hopw someone can help, thanks.

    The biggest problem you are going to have is sync. There is no way to keep these two computers in sync unless you hook up some kind of KVM USB splitter for your keyboard. Both machines would need to be identical in setup or this will not work. Playback and record buttons need to be pressed at the exact same time. The mouse can be used to trigger events (such as record enable) to each computer. It is not a very elegant or pragmatic way of gaining more tracks.
    The better way is to use a dual G5 with a big monitor.

  • Maximum number of client that possible to running OSD at the same time?

    How maximum number of client that possible to perform OS deployment from SCCM 2012 R2 at the same time?
    Regards, Bar Waelah

    It depends on your infrastructure and design. 
    My DP servers got mirrored mechanical disks and a Gbit nic. We like to run about 10 clients every 2 hours from them. That is enough time to apply our custom image, apply any extra appps and patches. 
    Since we got one of those servers on about 100 locations it means that in the best case I can deploy about 1000 systems every two hours. 
    That's my technical limit BUT that's not the real limit.
    More important is how many users with newly installed systems can your organization handle. There will always be some machines that fails and needs to be fixed (how many non productive users can you have at the same time?). Some users will call hellpdesk
    regardless of instructions, onscreen information, user training and so on. How many calls can your helpdesk handle? There will be requests for extra apps, changed screen resolution, left handed mice settings and so on, maybe printer configs? Same thing here
    - how many of these cases can your support handle?
    Those are the "soft" limiting factors and so far (been doing this for about 15 years now) the "soft" limits have always been lower than the technical limit

  • How to make two Range Selection at the same time?

    In a single clip, at the same time, in two locations, I would like to have Range Selection.  Then I would like to switch between the two and play within the range one after the other immedeately. Is this possible?  Thanks.

    success1975 wrote:
    In a single clip, at the same time, in two locations, I would like to have Range Selection. 
    You can mark multiple range selections in a clip by clicking and dragging with the Command key down – or marking in and out points with  Shift+Command.
    I don't know what you mean when you say "at the same time".
    Then I would like to switch between the two and play within the range one after the other immedeately. Is this possible?  Thanks.
    Forward slash plays betweeen the in and out. The only way I know to play them one after the other "immediatelly" is to edit the two selections to the timeline.
    Russ

  • How to make this two things at the same time ?

    Hello
    When my mouse is on a area, I need :
        -  to show a object (a rectangle inserted with the toolbar)
        -  to show a caption
    I think it's not possible to do this two things at the same time when I use the rollover functions (Rollover caption or Rollover Image).
    I would like to use a button, but the button works only if I click it, and not when I just pass my mouse on it.
    Someone have an Idea?
    I can't use Javascript.
    Thanks

    Rick is correct.  You can use the Rollover Slidelet's rollover area to trigger an Advanced Action.  You'll need to create this Advanced Action with two clauses.  One to SHOW the caption, and the other to SHOW the rectangle.
    Your alternative to the rollover slidelet is to use an Event Handler widget attached to the object that the mouse should roll over.
    The Event Handler will detect when the mouse is over the object and trigger its own Success criteria.  You can then use the widget's ON Success event to trigger the Advanced Action as mentioned above.
    More information about using the Event Handler here: http://www.infosemantics.com.au/adobe-captivate-widgets/download-free-trial-widgets
    An example of using it to do two different things on the same object can be found at this web page: http://www.infosemantics.com.au/adobe-captivate-advanced-elearning-tutorials/beat-adobe-ca ptivate-interactive-catch22
    Trial versions of the widget can be downloaded from here:  http://www.infosemantics.com.au/adobe-captivate-widgets/download-free-trial-widgets

  • Bluetooth mouse and keyboard go off exactly the same time, and don't connect agian after ive installed the mac os x 10.8 updates please fix this apple

    After Installing the mac os x update for 10.6.8 ive recentley in the last couple of days the bluetooth mouse and keyboard going off at the same time ive looked at some help but i feel like this is a software bug after installing so any other suggetions than taking it into an Apple Store,
    I hope apple fixthis problem in there next patch update.

    Hi,
    Welcome to the    Discussions
    Does the App launch form the Applications Folder rather than the DOCK ?
    The icons in the DOCK are links to the App. Sometimes this link can get broken.
    8:37 PM Sunday; December 27, 2009
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"

  • HT2905 What if they were all added at exactly the same time?

    I imported music from my old laptop, and now there are duplicates and triplicates of most of the songs in my library. They were all added at the same time though, so I cannot simply delete the older ones. Is there any quick way to get rid of extra copies of songs? Deleting them one by one would take a whole day.

    I've written a script called DeDuper which can help remove unwanted duplicates. See this  thread for background.
    tt2

Maybe you are looking for

  • Acrylic 20" Cinema Display with new MacPro

    As I read the posts here, to use the old cinema display with an ADC connector I will need to buy Apple DVI to ADC adapter to connect my 20" cinema display with ADC to the new MacPro? This new DVI to ADC adapter provides power for the cinema display a

  • Java Logging, problem recreating Thrown record from XML

    Ok, so I've got all these log files that are using the default java.util.logging.XMLFormatter so all the output is in XML. I'm writing a parser that reads the XML file and recreates LogRecord objects for each of the record entries. Everything works g

  • Convertion time with quick time pro

    I have a couple of snowboarding films that I have tried to convert to play on my ipod video. The problem is that one of the videos, about 300 megs took about 30 hours to convert and when played on my Ipod has no sound. I am trying to convert another

  • Video to Mac

    I want to shoot video w/iPad2, then transfer the file to my iMac for editing in iMovie. The normal sync to iPhoto works, but how can I get it to iMovie? Thanks in advance, Paul

  • No Data Received

    Been using iCHAT for several months and in the last 4 days my son and I get disconnected while talking (After 5-6 seconds) with message that No Data received in last 10 seconds. Connection doctor gives no understandable reason.