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

The Archive Base Latest Questions

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

lets have example.. some complex work is divided by 4 thread thread -A is

  • 0

lets have example..

some complex work is divided by 4 thread

thread -A is calling function_A
thread -B is calling function_B
thread -C is calling function_C
thread -D is calling function_D

now condition is that thread A,B,C can work at same time but when ever thread D is executing function_D it will see does any thread from A,B,C is executing there function ? if yes then it will wait for them completion and when no thread from a,b,c is executing there function, thread D will start to execute function D.

How can i do that ? any ruff idea?

EDIT : function_A,function_B,function_c is using one handle. and function_D is closing that handle. When ever any function is using that handle it should not be closed by function_d.

  • 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-26T20:27:17+00:00Added an answer on May 26, 2026 at 8:27 pm

    This sounds like a job for a counting semaphore.

    Each thread using the handle should increment the semaphore value. Thread D should wait on the semaphore to reach zero.

    If you implement this without care for when thread D runs, do not be surprised if thread D runs before A, B or C and closes the handle immediately.

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

Sidebar

Related Questions

So for example ... Lets say I have a Posts model and a News
This is a contrived example, but lets say I have declared objects: CustomObj fooObj;
Best to use an example to describe the problem. Lets say I have a
I have 2 websites, lets say - example.com and example1.com example.com has a database
To use as an example: lets say that I have 2 EditText s and
Lets say I have some pdf files stored on my server and I only
Lets say I have a class that is supposed to generate some ID (for
So I have two custom complex types like this (oversimplified for this example): public
Lets say I have a LineItem (from the over used Shopping Cart example) and
I have a complex query that includes some dynamic sql which partially depends upon

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.