Given the following environment

#include
#include

void *thread(void *);

int main()
{
pthread_t tid;

// Code Fragment Goes Here

return 0;
}

void *thread
(void *argument)
{
for (int count = 0; count < 10000; count++)
cout << "Loop Count " << count << endl;

return NULL;
}
Write a code fragment that creates a thread that runs the function named thread and then waits for the thread to complete.


pthread_create(&tid, NULL, thread, NULL);
pthread_join(tid, NULL);

Computer Science & Information Technology

You might also like to view...

What advantage does using a circular collider give us over a box or polygon collider?

What will be an ideal response?

Computer Science & Information Technology

Approximately how much data could a CPU with an external clock speed of 2 GHz and a 32-bit data bus transfer per second?

A. 4 Gigabits B. 8 Gigabits C. 4 Gigabytes D. 8 Gigabytes

Computer Science & Information Technology

Write SQL*Plus command to display a character column in 30 columns, and a numeric column with 9,999.99 format.

Write queries/statements for the following. (Use tables created in Chapter 4 Lab Activity.)

Computer Science & Information Technology

When inserting a section break in a report with a cover page and table of contents, position the insertion point at the top of the first page of the report and insert a Next page break.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology