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
During January, Luxury Cruise Lines incurs employee salaries of $1.1 million. Withholdings in January are $84,150 for the employ
finlep [7]

Answer:

Explanation:

The journal entries are shown below:

1. Salary expense A/c Dr $1,100,000

             To income tax payable A/c $233,750

             To FICA Tax payable A/c    $84,150

             To Accounts payable A/c    $11,000

             To Salaries payable A/c       $771,100

(Being the expenses and Withholding are recorded and the remaining balance is credited to salary payable account)

2. Salary expense A/c Dr $33,000

         To Accounts payable A/c    $33,000

(Being the employer portion of health insurance is recorded)

3. Payroll tax expense A/c Dr $152,350

      To FICA Tax payable A/c    $84,150

      To Unemployment tax payable A/c $68,200

(Being payroll tax expense is recorded)

5 0
3 years ago
A firm has four different investment options. Option A will give the firm $10 million at the end of one year, $10 million at the
xxMikexx [17]

Answer:

The answer is "Option D".

Explanation:

Using the formula for calculating present value:

= \frac{Future \ value}{(1+r)^n}\\\\

that's why "Option D" is correct.

8 0
2 years ago
Which type of rice will remain firm and separate when cooked properly?
Soloha48 [4]
Long-Grained rice. Hope this helps:)
5 0
3 years ago
Which sentence from the contract shown below refers to consideration?
mamaluj [8]

first party is the one that I would do

4 0
2 years ago
James Stillman is an investment adviser representative with Rock, Feller, and Standard (RFS), a covered adviser with its princip
liubo4ka [24]

Answer:

Stillman should register as an investment adviser representative in state P.

Explanation:

Investment adviser representatives (IARs) must necessarily register in the state that they work in. In this case, Rock, Feller, and Standard (RFS) must be registered in all the states where it has offices functioning, but Stillman only needs to register in the state where his office is. If Stillman worked half year in state P and the other half in state M, then he would need to register in both states. But since this is not the case, then registering in state P should be enough.

3 0
3 years ago
Other questions:
  • Which of the following term describes what a manufacturer spends for goods or services? A. cost B. price C. markup
    5·1 answer
  • Cat's Coaster Company uses cork in all of the protective drink coasters that it manufactures. If Cat's enters into an agreement
    10·2 answers
  • Public orders on a designated market maker's book show Broker A bidding for 100 shares of ABC Corporation at 42.25. Broker B is
    12·1 answer
  • Other things the same, a decrease in the price level makes consumers feel a. more wealthy, so the quantity of goods and services
    15·1 answer
  • In order to understand how a specific business firm uses information systems, you need to know something about the history and c
    12·1 answer
  • The glo-brite company is considering development of a new children's toothpaste in fun-shaped dispensers. before performing any
    15·2 answers
  • William is a single writer (age 35) who recently decided that he needs to save more for retirement. his 2017 agi is $65,000 (all
    15·1 answer
  • Suppose that due to a severe drought in Texas, 100,000 farmers relocate from Texas to Louisiana. Assuming that land and labor ar
    9·1 answer
  • DTO, Inc., has sales of $15 million, total assets of $12.6 million, and total debt of $5.6 million. Assume the profit margin is
    9·1 answer
  • The Laffer curve shows that Group of answer choices at some specific tax rate, tax revenue is maximized. tax revenue is constant
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!