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
Knowledge Check 01 Which of the following is a correct statement regarding control of over-the-counter cash receipts: multiple c
nevsk [136]

Answer: The supervisor should compare the register transactions with the cash receipts report to make sure that both are correct.

Explanation:

The cash register shows the actual amount of money that is collected by the business during the day and the cash receipts journal records the cash collected.

There is therefore a need to ensure that these two tally up as a control method. The supervisors should therefore check for this and if they find that these two are not the same, it means that there is an error somewhere that needs to be rectified.

4 0
3 years ago
A certificate of deposit offers a nominal interest rate of 3.5 percent annually.
Snezhnost [94]
I’m pretty sure the answer is c
4 0
3 years ago
For the budget period ending December 31 of the current year, Aaron Corporation estimates its ending balances for cash as $4,000
jek_recluse [69]

Answer:

The amount of total current assets that will be reported on the budgeted balance sheet is $40,000.

Explanation:

Total current assets

= Cash + Accounts receivable + Finished goods inventory + Raw materials inventory

= $4,000 + $16,000 + $12,000 + $8,000

= $40,000

Therefore, The amount of total current assets that will be reported on the budgeted balance sheet is $40,000.

3 0
4 years ago
Shannon Corporation manufactures custom cabinets for kitchens. It uses a normal costing system with two direct cost categories:
adelina 88 [10]

Answer:

please find the answers below

Explanation:

Shannon corporation:

The inventory cycle of is composed of 3 phases:

1. Ordering / purchases

2. Production

3. Finished good / sales

The ordering phase is when the company orders goods and the time it takes to receive the raw materials.

The production phase is the work in process phase when the raw materials are converted into finished goods.

The finished goods/ sales phase is the time it takes to sell the goods that were manufactured.

Journal entries in a manufacturing company are used to record transactions. Adjusting journal entries are used to recognize costs and revenues in the correct period.  

Dr Work – In - process                            $75, 000

Cr Inventory- Direct materials                                   $$75, 000

Recording actual direct materials used

Dr Wages Payroll                           $55, 500

Cr Cash /Bank                                            $55, 500

Recording direct labor wages incurred

Dr Manufacturing overhead          $3, 500

Cr Inventory- Indirect materials                  $3, 500

Recording the cost of indirect materials incurred

Dr Manufacturing overhead         $49, 000

Cr Cash/ Bank                                    $49, 000

Recording wages payable to supervisor and engineer

Dr Manufacturing overhead         $13, 000

Cr Cash/ Bank                                                 $13, 000

Plant utilities and repairs taken to manufacturing overhead

Dr Manufacturing overhead                $11, 000

Cr Accumulated depreciation – plant                 $11, 000

Record depreciation on factory plant

Dr Finished goods                                $190, 000

Cr Work – In – Process                                            $190, 000

Record of jobs completed (cost of goods manufactured)

Dr Work – in – process                       $76, 500

Cr Manufacturing overhead                                   $76, 500

Record overhead applied to production

[$3, 500 + $49, 000 + $13, 000 + $11, 000 = $76, 500]

Dr Cost of goods sold                         $145, 000

Cr finished goods                                                        $145, 000

Record cost of jobs or goods completed and sold

8 0
3 years ago
A machine can be purchased for $150,000 and used for five years, yielding the following net incomes. In projecting net incomes,
umka2103 [35]

Answer:

2.69 years

Explanation:

Payback period calculates the amount of the time it takes to recover the amount invested in a project from its cumulative cash flows.

To derive cash flows from net income, add depreciation to the net income.

Straight line depreciation = (Cost of asset - Salvage value) / useful life

$150,000 / 5 = $30,000

The depreciation expense each year would be $30,000.

Cash flow in year 1 = $30,000 + $10,000 = $40,000

Cash flow in year 2 = $30,000 + $25,000 = $55,000

Cash flow in year 3 = $30,000 + $50,000 = $80,000

Cash flow in year 4 = $30,000 + $37,500 = $67,500

Cash flow in year 5 = $30,000 + $100,000 = $130,000

In the first year, -150,000 + $40,000 = $-110,000 is recovered

In the second year, $-110,000 + $55,000 = $-55,000 is recovered

In the third year, $-55,000 + $80,000 = $25,000 is recovered.

The cash payback period is 2 years + $-55,000 / $80,000 = 2.69 years

I hope my answer helps you

6 0
3 years ago
Other questions:
  • 6: the cost of a protein bar increased from $2.50 to $2.80. the percent increase in the $2.80 rate was how much?
    15·1 answer
  • _______ is a non-cash expense representing the cost assets as they lose value over time
    5·1 answer
  • Lagoon has two food stores Buck's and Combo's. It costs $1 to make one of Buck's bread loaves and $2 to make one of Combo's chee
    11·1 answer
  • Its best if you share details of a personal appointment when you need time off work. True False
    14·1 answer
  • Roberta's monthly bank statement says that she has a balance of 386.29, but Roberta's check register says that her balance is 37
    7·2 answers
  • When purchasing a new computer, first determine the brand you want. True or False
    11·2 answers
  • An asset used in a four-year project falls in the five-year MACRS class for tax purposes. The asset has an acquisition cost of $
    11·1 answer
  • Compare the following sets of message openers. Circle the letter of the opener that illustrates a direct opening. Write an appro
    5·1 answer
  • Which of the following describes the means by which a message is sent. A. managing B. message C. media D. language
    15·1 answer
  • Money is a ______ of some item or group of items that is used as a medium of exchange.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!