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
Kansas Enterprises purchased equipment for $72,500 on January 1, 2021. The equipment is expected to have a five-year service lif
cupoosta [38]

Answer:

Depreciation expense $12,910

Book value $46,680

Explanation:

Kansas Enterprises

Formula for Depreciation expenses

Annual depreciation expense=(Cost-Residual value)/Useful Life

Where,

Cost = 72,500

Residual value =7,950

Useful life = 5 years

Let plug in the formula

=(72,500-7950)/5

=64,550/5

=$12,910/year

Therefore depreciation expense for 2021

=$12,910

Calulation for Book value

Book value = $72,500 – ($12,910× 2)

$72,500 -$25,820

=$46,680

Therefore the book value would be $46,680

8 0
4 years ago
A sole proprietor of a farm implement store sold a truck for $15,000 that had been used to make service calls. the truck cost $3
Anni [7]
It should be reported as an ordinary<span> gain</span> because the truck is considered as ordinary <span>asset used in the ordinary course of business. The truck was used as service calls apparently used in the normal operation of the company thus the gain on the sale of this asset should be considered </span>as  an<span> ordinary gain.</span>
7 0
3 years ago
The "glass ceiling" is a term used to describe a discriminatory practice applicable to women only.
goldenfox [79]
<span>This can also be termed as "Unfair limitation" and it is the term used to portray boundaries that keep ladies and minorities from progressing to administration positions in big companies and associations. The expression was first utilised around 1985 or 1986.</span>
7 0
3 years ago
A local ice-cream parlor has 100 customers in the "rush" hour between 5PM and 6PM (assume that the customers arrive according to
WITCHER [35]

Answer: 36 seconds.

Explanation:

Based on the information given in the question, the Taktzeit for the ice-cream scoopers will be calculated thus:

First and foremost, Taktzeit refers to the time taken between the beginning of production for one unit and the beginning of the next unit.

From the information given, the available Time is 1 hour which can be converted to secunds and this will be:

1 hour = 3600 seconds

Hourly Demand = 100

Then, the takzeit will be:

= 3600/100

= 36 seconds

5 0
3 years ago
Describe how the concept of beta impacts financial decision making
Dima020 [189]

The concept of beta impacts financial decision making by providing information volatility or systematic risk of a security.

The information that provided by the concept of beta would take form in a comparison between your chosen securities with other securities that exist in the market. For investors who prefer low risk but small and steady return, they can use the concept of beta to find out the securities with low level of volatility.

6 0
4 years ago
Other questions:
  • Assume that you manage a $10.00 million mutual fund that has a beta of 1.05 and a 9.50% required return. The risk-free rate is 2
    13·1 answer
  • Assignment 2 (Due Week 3)
    11·1 answer
  • Many locations require that renters be paid interest on their security deposits. If you have a security deposit of $3,600, how m
    5·1 answer
  • According to the U.S. Department of Labor Statistics, _____ is the industry earning the highest average annual wage in 2009.
    9·2 answers
  • Arrangement in which a buyer purchases the right to sell the good or service of the seller is called _________.
    12·1 answer
  • According to the quantity theory of​ money, what must the growth rate of the money supply be given the following​ information? T
    5·2 answers
  • The pipe located underneath Jiro’s kitchen sink was leaking and he did not know how to fix it. He called a plumber who agreed to
    11·1 answer
  • What does a good business plan contain?​<br><br>helppppp pls
    8·1 answer
  • Identify the impacts of internationalisation of logistics to an organisation
    15·1 answer
  • Kathy is buying her first home. She is financing a total of $185,000 at an APR of 5% for 25 years. How much are her monthly paym
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!