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
What isn't not a stock derivative
nadezda [96]
A derivative<span> is a contract between two or more parties whose value is based on an agreed-upon underlying financial asset, index, or security. ... Similarly, a </span>stock<span>option is a </span>derivative<span> because its value is "derived" from that of the underlying</span>stock<span>.</span>
7 0
3 years ago
Studies on a machine that molds plastic water pipe indicate that when it is injecting 1-inch diameter pipe, the process standard
Otrada [13]

Answer:

b. 0.67

Explanation:

UCL = 1 + 0.10

        = 1.10 inch

LCL = 1 - 0.10

       = 0.9 inch

standard deviation = 0.005 inch

mean = 1 inch

Cpk

= min[(UCL - mean)/(3*standard deviation) , (mean - LCL)/(3*standard deviation))]

= min[(1.10 - 1)/(3*0.05) , (1 - 0.9)/(3*0.05))]

= min[0.67 , 0.67]

= 0.67

Therefore, Theprocess capability index (Cpk) if the long-run process mean is 1 inch is 0.67

3 0
3 years ago
Suppose that a monopoly computer chip maker increases production from 10 microchips to 11 microchips. If the market price declin
Sergeu [11.5K]

Answer:

$19

Explanation:

Marginal revenue is the change in revenue when production increases by one unit

Marginal revenue = change in total revenue / change in quantity produced

total revenue 1 = $30 x 10 = $300

Total revenue 2 = $29 x 11 = $319

change in total revenue = $319 - $3000 = $19

Change in quantity produced = 11 - 10 = 1

Marginal revenue = $19 / 1 = 19

5 0
3 years ago
If the Sampson Company, a supplier of wood, understands the needs and requirements for wood for a few firms within a NAICS class
Helen [10]

Answer:

The answer is "Option c".

Explanation:

The customer service must matter arising' needs to fulfill everyone. The Sampson Company, a timber manufacturer, understands the wood specifications or conditions for several firms within the NAICS category. Within this case, the Dunn Company will develop the timber specifications or criteria of all firms underclass.

5 0
3 years ago
Pronunciation and enunciation have all of the following in common except a. Both involve how you articulate b. Both are importan
kompoz [17]

Answer:

both are tied to nonverbal communication

8 0
2 years ago
Other questions:
  • Total interest paid on a 30-year straight note was $230,000 during the term of the loan. The annual interest rate was 6.6%. What
    5·1 answer
  • The government of Wrexington, a country which has adopted American GDP accounting conventions, has calculated that the seasonall
    5·1 answer
  • Kalyan Corporation uses the FIFO method in its process costing system. Operating data for the Enameling Department for the month
    10·1 answer
  • During 2014, a textbook written by Mercer Co. personnel was sold to Roark Publishing, Inc., for royalties of 10% on sales. Royal
    12·1 answer
  • Which of the following acronyms identifies the Big Five personality dimensions
    11·1 answer
  • This partnership was approached by a corporation that would like to acquire them by a stock acquisition. The partnership has no
    14·1 answer
  • The percentage of decrease in the average price of the economy’s goods and services is known as the __________.
    8·1 answer
  • Crystal Glasses recently paid a dividend of​ $2.70 per​ share, is currently expected to grow at a constant rate of​ 5%, and has
    15·1 answer
  • You can display good customer service by
    9·2 answers
  • What is functional structure in organization?​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!