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 8533657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:01:03+00:00 2026-06-11T10:01:03+00:00

I have a thread working in the background and but it doesn’t always has

  • 0

I have a thread working in the background and but it doesn’t always has work to do. I want it to wait for data to be passed by the main thread and then continue working.

At first I thought that’s what wait() and notify() were for but it seems to work the other way around.

How do I do that?

  • 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-06-11T10:01:05+00:00Added an answer on June 11, 2026 at 10:01 am

    See my comment.

    Sounds like you want a BlockingQueue — this is a very common requirement for producer-consumer problems. Try not to reinvent the wheel 😉

    There exist multiple BlockingQueue implementations, e.g. a bounded ArrayBlockingQueue, an unbounded LinkedBlockingQueue, a hand-off SynchronousQueue, even a PriorityBlockingQueue. All BlockingDeques and TransferQueues are also BlockingQueues 😉

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

Sidebar

Related Questions

Background: I'm working on an application that already has a thread system designed. It's
I have a background thread doing some processing, and saving to Core Data. In
I am working on a multi-thread program, and have a question about where to
I have thread where downloading xml file a this xml file i want to
Suppose I have thread 1, the main window UI thread and thread 2, a
Is if almost always required to have thread syncing (i.e. use of mutex, semaphores,
I have a thread which needs to be run in the background every 1000ms.
I have some thread to write resource and some to read it.But pthread_rwlock cause
I have several thread pools and I want my application to handle a cancel
Background: I am working on an Android Honeycomb (v3.0) application that has a requirement

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.