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

  • Home
  • SEARCH
  • 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 6870335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:40:16+00:00 2026-05-27T03:40:16+00:00

We are creating a peer to peer program (in c), and we are using

  • 0

We are creating a peer to peer program (in c), and we are using multiple threads so that the program can listen for new connections and receive/send data as well.

The problem is, I remember my prof telling us that if you have multiple threads running on the same process, if one has to wait for user input, the entire process is “halted” so none of the other threads will keep running.

But then we have been reading up, and it seems like if one thread is waiting on input, the others keep running as usual…

Which one is right? If we have the program waiting for user input (ya know, things like connect to X or send X a message) on one thread, and another thread just sitting there in an infinite loop waiting for a peer to try to connect, will it still be listening for connections?

thanks! hopefully this makes sense…threads are just so confusing 🙁

  • 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-27T03:40:17+00:00Added an answer on May 27, 2026 at 3:40 am

    Yes, on majority of contemporary operating systems multiple threads within one process can be waiting for input (from stdin, from sockets, etc.) while other can be working.

    Consider your browser. While you surf the Internet the user interface does not freeze when you wait for a page to load (i.e. one of browser’s threads is waiting for the input from a socket connected to a remote host).

    (…) and another thread just sitting there in an infinite loop waiting for a peer to try to connect (…)

    That’s called busy waiting and it’s considered a bad practice. Take a look at select(2), epoll(4) or related mechanisms instead.

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

Sidebar

Related Questions

I have been creating a peer to peer connection for a new game, that
I'm creating an app (C#) that is going to send some messages around the
Creating a zip file using Send To -> Compressed folder excludes .hg folder on
Im trying to create a password protected peer group using JXTA. For that i
I am currently creating a Game Center game, and am using the peer-to-peer functionality
I’m looking at creating a P2P system. During initial research, I’m reading from Peer-to-Peer
Creating liquid layouts is an immense pain. Now, I totally understand that tables should
Creating a calculator-like dialog, I noticed that quickly clicking on a button in IE
Creating an installer for possible remote systems so that if they do not have
Creating a table without tbody using javascript createElement/appendChild will not add tbody in Firebug

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.