Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7178611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:57:22+00:00 2026-05-28T16:57:22+00:00

I have a timing issue and I don’t know how to fix it. In

  • 0

I have a timing issue and I don’t know how to fix it.

In my second loop, Display card, it loops and each connection starts a class called cLookAtCardConnection. This class will sometimes set the flag mPlayerList.GetNextFlag(), thus causing the loop to exit and the program goes to the first loop, Turn card over, which calls the class cLookAtCardConnection

The problem is that after mPlayerList.GetNextFlag() is set, the next couple connections are still in the same loop and call the class cLookAtCardConnection instead of (exiting?) the loop when the flag is set and going into the loop that calls cLookAtCardConnection.

Why is there a delay in the loop exiting after the flag has been set?

while( lBoard.Next()==true)
        {

        mPlayerList.Next();

        // inner loop wait for all players
        /////////////////////////////////////////////////////////////////////////////
        // turn one card over
         mPlayerList.WaitForAllPlayers();
            do
            {
                    do{
                        r=GetClient();
                        switch(r)
                        {
                        case 0: return; // exitvon a very bad error
                        }
                    } while(r==2);// loop if it was a timeout               
                    cTurnCardOvrerConnection thread = new cLookAtCardConnection("thread3", connection, mPlayerList, mPlayersMessages, lBoard);

                } while( mPlayerList.AllPlayersFinished()==false);// end while

            //////////////////////////////////////////////////////////////////////////
            // Display card -LOOK AT CARD
            mPlayerList.ClearNextFlag();
             mPlayerList.WaitForAllPlayers();
            do
            {
                System.out.println(Thread.currentThread()+": Display card \r");
                    do{
                        r=GetClient();
                        switch(r)
                        {
                        case 0: return; // exitvon a very bad error
                        }
                    } while(r==2);// loop if it was a timeout       
                    cLookAtCardConnection thread = new cLookAtCardConnection("thread3", connection, mPlayerList, mPlayersMessages, lBoard);

// after this flag is set the next couple connectons are still in this loop???      
            } while( mPlayerList.GetNextFlag()==false);// end while

        } // reloop game board
    } // loop forever   
    //      System.out.println("--------- Eit player loop ------------------- \r"); 

        } catch(IOException ec)
        {
            System.out.println(ec.getMessage());            
        }



      } // end run

} // end of class
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T16:57:23+00:00Added an answer on May 28, 2026 at 4:57 pm

    You probably need to set up a synchronized block so that the code inside the do-while loop is only accessible to a single thread at a time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think i have a timing issue. It perplexes me why. On the trigger
I have a stored procedure currently executing a complicated fetch that is frequently timing
I have an update query being run by a cron task that's timing out.
A have two entities. For example timing settings and orders. @Entity public class TimingSettings{
We've run into an issue with the New-Deployment Azure Powershell commandlet timing out; we've
I have a series of databases, each of which is basically standalone. It initially
My basic issue is this, I have events firing on pages I've left based
I have a legacy (solve this problem for us issue) app that communicates with
I’m relatively new to all the intricacies of javascript so perhaps this timing issue
I am having some issues doing basic math with Java. I don't know why

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.