[SOLVED] CS计算机代考程序代写 #include

30 $

File Name: CS计算机代考程序代写_#include.zip
File Size: 357.96 KB

SKU: 0818514053 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


#include
#include
#include
#include // Shouldn’t be needed once everything is working
#include
#include #include

#include “pool.h”

using namespace std;

/// thread_pool::Internal is the class that stores all the members of a
/// thread_pool object. To avoid pulling too much into the .h file, we are using
/// the PIMPL pattern
/// (https://www.geeksforgeeks.org/pimpl-idiom-in-c-with-examples/)
struct thread_pool::Internal {

// INSTRUCTOR NOTE: YOU WILL NEED TO ADD FIELDS TO THIS STRUCT

/// construct the Internal object by setting the fields that are
/// user-specified
///
/// @param handler The code to run whenever something arrives in the pool
Internal(function handler) {}

/// Each thread in the pool runs thread_task() to get new sockets from the
/// queue and run the handler on them.When threads can’t get something, they
/// wait on a condvar.
void thread_task() {}
};

/// construct a thread pool by providing a size and the function to run on
/// each element that arrives in the queue
///
/// @param sizeThe number of threads in the pool
/// @param handler The code to run whenever something arrives in the pool
thread_pool::thread_pool(int size, function handler)
: fields(new Internal(handler)) {
cout << “thread pool constructor is not implemented” << endl;}/// destruct a thread poolthread_pool::~thread_pool() = default;/// Allow a user of the pool to provide some code to run when the pool decides/// it needs to shut down.////// @param func The code that should be run when the pool shuts downvoid thread_pool::set_shutdown_handler(function func) {
cout << “set_shutdown_handler is not implemented” << endl;}/// Allow a user of the pool to see if the pool has been shut downbool thread_pool::check_active() {cout << “check_active is not implemented” << endl;return false;}/// Shutting down the pool can take some time.await_shutdown() lets a user/// of the pool wait until the threads are all done servicing clients.void thread_pool::await_shutdown() {cout << “await_shutdown is not implemented” << endl;}/// When a new connection arrives at the server, it calls this to pass the/// connection to the pool for processing.////// @param sd The socket descriptor for the new connectionvoid thread_pool::service_connection(int sd) {cout << “service_connection is not implemented” << endl;}

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS计算机代考程序代写 #include
30 $