Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

n this assignment, you are going to do two things. First off, you are going to use signals to allow a program to respond to

n this assignment, you are going to do two things. First off, you are going to use signals to allow a program to respond to user input. Second, you are going to develop simple multi-threaded code. To begin with, your main program will spawn off a second thread, referred to as the clock thread. This thread will loop so long as the keepGoing boolean is set to true. Every 10 seconds, it will print out a count to the console. It then will obtain the time as a struct tm, add the offset, and print the time to the console. When this is finished, it will start a thread, as a detached thread, which will run the detached thread. The clockThread will then go to sleep for 10 seconds, at which point the process will repeat itself. The detachedThread, which is to run as a detached thread, will print the text "BEEP", followed by a 1 second delay, "BEEP", followed by a 1 second delay, and "BEEP" before exiting. The program overall will stay blocked, waiting for the thread to exit. However, if a SIGUSR1 is received, the offset will increment by a value of 1 hour and the count will be incremented by 60. If a SIGUSR2 is received, the offset will decrease by 1 hour and the count will be decreased by 60. If a SIGHUP is received, keepGoing will be set to false. You are given a template for the program with completed comments. Your goal is to complete the program so that it works properly and then answer the questions in Canvas. To answer the questions, you will also need to run the demo code at least once.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions

Question

LO5 Highlight five external recruiting sources.

Answered: 1 week ago