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
Piedmont Hotels is an all-equity company. Its stock has a beta of .82. The market risk premium is 6.9 percent and the risk-free
katrin2010 [14]

Answer:

11.86%

Explanation:

Piedmont hotels can be described as an all-equity company

Its stock has a beta of 0.82

The market risk premium is 6.9%

The risk free rate is 4.5%

The adjustment is 1.7%

Therefore, the required rate of return can be calculated as follows

Required rate of return= Risk free rate of return + ( beta×market risk premium) + adjustment

= 4.5% + (0.82×6.9%) + 1.7%

= 4.5% + 5.658 + 1.7%

= 11.86%

Hence the required rate of return for the project is 11.86%

7 0
3 years ago
What is a key factor you should consider when determining asset allocation
scoray [572]

Answer: Did u find out the anser?

Explanation: Im taking the quiz now

8 0
2 years ago
The two major types of transactions that affect the international flow of money are:
andre [41]
The two major types of transaction that affects the international flow of money are b. debits and credits.
When you say debits, it the liabilities and when you say credits its the assets. These two is the major transaction that makes a big impact to the economy.
4 0
3 years ago
Read 2 more answers
Portfolio investment is defined as A. the diversification of purchasing shares in many companies in one country so that risk is
disa [49]

Answer:b

Explanation:

4 0
3 years ago
Detroit Corporation sued Chicago Corporation for intentional damage to Detroit's goodwill. Detroit had created its goodwill thro
Grace [21]

Answer:

d. The $1,500,000 is not taxable because Detroit settled the case

Explanation:

The $1,500,000 is not taxable because Detroit settled the case, Compensation received of damaging Goodwill is not taxable.

8 0
3 years ago
Other questions:
  • Matthew Granger is a member of the board of directors at Produxicore Inc. Over a period of one year, Matthew failed to attend mo
    14·1 answer
  • Walmart reduced waste in packaging by 3,500 tons by __________.
    6·1 answer
  • The annual revenue of the tie-dye t-shirt operation is currently $5,000 but is decreasing by $500 each year. how fast are annual
    9·1 answer
  • 34s left The National Income Accounts Unanswered GNP equals GDP A. minus net receipts of factor income from the rest of the worl
    5·1 answer
  • The statement of cash flows reports all but which of the following: Multiple Choice
    14·1 answer
  • A tyre manufacturer wants to set a minimum mileage guarantee on its new MX100 tyre. Tests reveal the mean mileage is 47,900 with
    12·1 answer
  • Refer to the makeup of a firms capitalization
    9·2 answers
  • The stages of formation of the Psalter may be compared to a(n) _______ .
    11·1 answer
  • Supply - supply curve - and supply schedule are:Multiple choice question.all the same.three different ways of expressing informa
    8·1 answer
  • Cannibalization occurs when a producer offers a new product that takes sales away from its existing products
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!