1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Lena [83]
3 years ago
14

Assume you have a system that does not provide a usleep(unsigned long usec) call to suspend the execution of the thread for a gi

ven amount of time, say in ?secs. how would you implement this function using condition variables?
Business
1 answer:
Ilia_Sergeevich [38]3 years ago
4 0

#include <iostream>

#include <time.h>

using namespace std;

//usleep function declaration

void usleep(int microseconds);

//usleep function definition

void usleep(int microseconds) // Cross-platform sleep function

{

clock_t time_end;

time_end = clock() + microseconds * CLOCKS_PER_SEC / 1000000; //as 1 microsecond is 1/1000000 of a second.

while (clock() < time_end);

}

int main()

{

cout << "Before calling User defined usleep" << endl;

usleep(4000000);

cout << "After calling User defined usleep" << endl;

}

You might be interested in
A machine would cost $100,000, and would generate revenues of $21,000 per year. However, O&amp;M costs would be $7,000 per year.
fgiga [73]

Answer:

(a) What is the net present value of this potential investment?

Net present value of Investment is $(3,903)

(b) Should you invest in this machine?

We should not invest in this investment because Net present value of this investment is negative by discounting Minimum acceptable rate of return.

Explanation:

Present Values:

Revenue                    $144,146

O&M Cost                  ($48,049)

Initial Investment      <u>$(100,000)</u>

Net Present value     $(3,903)

Working :

Present Value Calculation = P x ( (1- ( 1 + r )^-10) / r

Revenue = $21,000 x ( (1- ( 1 + 0.075 )^-10) / 0.075 = 144,146

O&M Costs = $7,000 x ( (1- ( 1 + 0.075 )^-10) / 0.075 = 48,049

8 0
3 years ago
Read 2 more answers
Reynolds Manufacturers Inc. has estimated total factory overhead costs of $136,400 and expected direct labor hours of 12,400 for
Helga [31]
Jdhdhdhdjsuushdbdbdbudufjrjifufjfjfkfkfkididududjejdjdjfkkfjfjrufifiir
8 0
3 years ago
Linda visits her favorite clothing store and is disappointed to discover that the shirt she was hoping to purchase is out of sto
Julli [10]

Answer:

d. backorder

Explanation:

Based on the scenario being described within the question it can be said that the sales associate most likely offered to backorder the item for Linda. This is when a retailer places an order for a product that is no longer in stock for the time being, in order to comply with the customer, but will take a while for that order to come in and for the transaction to be completed.

8 0
3 years ago
Is there an opportunity cost to increased investment in capital goods today? Choose one: A. No, increased production of capital
g100num [7]

Answer: Option E

           

Explanation: Opportunity cost refers to the cost of loosing profit while choosing one alternative over other.

Taking the given case into consideration, if we invest more in capital goods today then the future generation will get more consumer goods and vice - versa. However as the capital is a limited resources we have to make a choice between capital goods and consumer goods in the present.

Hence if we invest more in capital goods today we will be having less of consumer goods.

3 0
3 years ago
Read 2 more answers
What are the OSHA violation types
Marina86 [1]
I say to look it up on the internet.


8 0
3 years ago
Other questions:
  • Jermaine lives in a world where the nominal interest rate is 3% and the inflation rate is 1%. today, jermaine has $200, with whi
    14·1 answer
  • 1-
    13·1 answer
  • Interview any local business owner and request him/her to identify any business problem that they are experiencing. Apply the De
    14·1 answer
  • Explain the tradeoffs that people may face when choosing a house or an apartment
    14·1 answer
  • _____ describes the practice of products and services traded among countries around the world.
    12·1 answer
  • Your campus computer store reported Sales Revenue of $168,000. The company's gross profit percentage was 60.0 percent. What amou
    13·1 answer
  • The city council wants suggestions for crime prevention techniques such as installing unbreakable glass on storefronts to presen
    9·1 answer
  • Tim and Sally are taking out a personal loan to pay for their wedding expenses. The loan is for $9,000 and comes with an interes
    13·1 answer
  • On March 1, 20Y8, Eric Keene and Renee Wallace form a partnership. Keene agrees to invest $21,060 in cash and merchandise invent
    11·1 answer
  • In what ways are consumer preferences changing in Ford’s different market segments and geographies? Are consumers able to articu
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!