Computers and Technology, 01.07.2021 15:10 Morghurley2000
Please use thread to complete the following program: one process opens a file data. txt, then creates a thread my_thread. The job of the thread my_thread is to count how many lines exist in the file data. txt, and return the number of lines to the calling process. The process then prints this number to the screen.
Basically, you need to implement main_process. c and thread_function. c.
Basic structure of main_process. c:
int main ()
{
Open the file data. txt and obtain the file handler fh;
Create a thread my_thread using pthread_create; pass fh to my_thread;
Wait until my_thread terminates, using pthread_join;
Print out how many lines exist in data. txt.}
Basic structure of thread_function. c:
void *count_lines(void *arg)
{
Obtain fh from arg;
Count how many lines num_lines exist in fh;
Close fh;
Return num_lines
}
Answers: 1
Computers and Technology, 23.06.2019 15:30
The song about casey jones a railroad engineer who gives his life on the job would most likely gall under the folk song category of? a-work song b-nonsense song c-religious song d-ballad
Answers: 1
Computers and Technology, 24.06.2019 10:00
Which two technologies support the building of single-page applications?
Answers: 2
Computers and Technology, 24.06.2019 14:30
Two students are discussing the flow of electricity. student a says that voltage is a measure of the amount of electron flow in a circuit. student b says that power is the product of voltage and current. which of the following statements is correct? a. only student a is correct b. only student b is correct c. both of the two students are correct d. neither of the two students is correct
Answers: 1
Computers and Technology, 24.06.2019 17:50
You will subnet the network address 172.31.103.0/24. the network has the following requirements: · room-114 lan will require 27 host ip addresses · room-279 lan will require 25 host ip addresses · room-312 lan will require 14 host ip addresses · room-407 lan will require 8 host ip addresses how many subnets are needed in the network topology?
Answers: 2
Please use thread to complete the following program: one process opens a file data. txt, then create...
Mathematics, 13.10.2020 01:01
Mathematics, 13.10.2020 01:01
History, 13.10.2020 01:01
Mathematics, 13.10.2020 01:01
Chemistry, 13.10.2020 01:01
Mathematics, 13.10.2020 01:01
Mathematics, 13.10.2020 01:01
Physics, 13.10.2020 01:01
Mathematics, 13.10.2020 01:01
Biology, 13.10.2020 01:01
History, 13.10.2020 01:01
Health, 13.10.2020 01:01