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]
4 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]4 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
Someone who likes building, designing, or creating things probably has a(n)
Afina-wow [57]
It is an architect because they love to build things and create things as well  <span />
6 0
4 years ago
Read 2 more answers
Swimmers Co. operates a set of water parks with leisure facilities for families in Aqualandia. During January 20X1, Swimmers acq
ElenaW [278]

The Swimmers Co.'s Boat's value in use (net present value) is Eur 321,221.

Data and Calculations:

Pre-tax discount rate = 5% p.a., excluding inflation

Inflation rate = 2% p.a.

Inflated discount rate = 7% (5% + 2%)

Salvage value = Eur 20,000

<u>Projected cash inflows:</u>

Year           Cash Inflows    Discount Factor     Discounted Cash flows

20X4         Eur 72,000              0.935                     $67,320

20X5        Eur 69,000               0.873                      60,237

20X6        Eur 64,000               0.816                      52,224

20X7        Eur 59,000               0.763                      45,017

20X8       Eur 52,000               0.666                      34,632

20X9       Eur 45,000               0.623                      28,035

20X10     Eur 38,000               0.582                        22,116

20X10     Eur 20,000              0.582                         11,640

Total discounted cash flows                         Eur 321,221

Thus, the Swimmers Co. will calculate the boat's value in use as Eur 321,221, taking into account all the discounted cash inflows.

Learn more: brainly.com/question/17185385

6 0
2 years ago
A __________________________ policy will cause a greater share of income to be collected from those with high incomes than from
serious [3.7K]

Answer: Progressive tax policy

Explanation: In a progressive tax policy the rate of tax increases with the amount of taxable income, thus, making it possible to tax the people with higher income high tax and the lower section of the society a low level of tax.

The concept of progressive tax policy is based on the concept of ability to pay and not necessity to pay.

Thus, from the above we can conclude that right option is A.

4 0
3 years ago
Which of the following is LEAST likely to be a reason for firms to form a cartel?
GalinKa [24]

Answer:

The correct answer is letter "C": to raise competition among firms in the cartel.

Explanation:

A cartel is a group of companies or countries working together to regulate the price of a single product they produce in common. The cartel makes it impossible for a foreign business to enter the market and demand lower prices. Cartels are, in most cases, not helpful to customers. They generate high prices that remain unchanged until consumers find alternative ways to purchase the same items.

Under such a scenario,<em> cartels are unlikely to be formed to generate more competition among the companies that compose them.</em>

4 0
3 years ago
The percent change in multifactor productivity if Fok can reduce the energy bill by ​$1,000 per day without cutting production o
marishachu [46]

Answer:

The answer is "2.45%".

Explanation:

The answer of option c:

Reduce power by 950 dollars:

In this question it will need to once again take the latest energy cost for analytical hierarchical productivity.  

→ Total Input  = 400 \times  12+21000 \times 1 +(5000-950)+10000

                     = 4800 +21000 + (4050)+10000  \\\\                       = 25800+4050+10000 \\\\                       = 39850\\

Consumer rates  = \frac{1,000}{39,850}

                            =0.0250

Initial efficiency multi-factor= 0.0245

\to \text{percentage  changes} = \frac{\text{New Multi Factor Productivity - Previous Multi-Factor Productivity}}{\text{Originbal Multi-Factor Productivity}}  

                                   = \frac{(0.02450.0251)}{0.0245}\\\\ = 2.45 \ \  \%

3 0
3 years ago
Other questions:
  • ​when an individual who has previously taken antabuse drinks alcohol, he or she will probably
    12·1 answer
  • Heidi, the founder of Camp Bow Wow, proves herself to be a leader as she asks her employees for suggestions and inputs before ma
    14·1 answer
  • _____________ tends to discourage firms from making physical capital investments.
    9·1 answer
  • Shasta Fixture Company manufactures faucets in a small manufacturing facility. The faucets are made from brass. Manufacturing ha
    10·1 answer
  • Which level of maintenance involves preventive and corrective procedures which are intended to restore equipment to a mission-ca
    5·1 answer
  • At the beginning of the current period, Griffey Corp. had balances in Accounts Receivable of $200,000 and in Allowance for Doubt
    11·1 answer
  • The high entry barriers in a given industry​
    6·1 answer
  • Computing Basic and Diluted Earnings per Share Soliman Corporation began the year 2018 with 25,000 shares of common stock and 5,
    10·1 answer
  • Santos International is a beauty salon in Texas. The salon is conveniently located in mid-town, and there is plenty of parking.
    15·1 answer
  • Company Z understands that their business is at risk. How can they use step two in the
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!