public ServerWorkerData(ReceiveFromServerWorkerConstruct p_receive_from_worker_construct, object p_server_pulse_object, RemoveWorker p_remove_worker)
 {
     receive_from_worker_construct = p_receive_from_worker_construct;
     remove_worker            = p_remove_worker;
     server_pulse_object      = p_server_pulse_object;
     worker_pulse_object      = new object();
     cancel_construct         = false;
     cancel_construct_lock    = new object();
     send_to_worker_construct = new SendToWorkerConstruct();
 }
        public static void WorkerProducerThread(Dictionary <int, KeyValuePair <Thread, ServerWorkerData> > p_all_workers_data, object p_all_workers_data_lock
                                                , object p_producer_pulse_object, ReceiveFromServerWorkerConstruct p_receive_from_worker_construct, WorkersPortNumberConstruct p_workers_port_number_construct
                                                , object p_server_pulse_object, IPAddress p_server_ip_address)
        {
            while (true)
            {
                lock (p_producer_pulse_object)
                {
                    if (!p_workers_port_number_construct.workers_port_number_queue_flag)
                    {
                        Monitor.Wait(p_producer_pulse_object);
                    }

                    if (p_workers_port_number_construct.workers_port_number_queue_flag)
                    {
                        if (p_workers_port_number_construct.workers_port_number_queue.Count > 0)
                        {
                            int port_num = p_workers_port_number_construct.workers_port_number_queue.Dequeue();
                            if (p_workers_port_number_construct.workers_port_number_queue.Count == 0)
                            {
                                p_workers_port_number_construct.workers_port_number_queue_flag = false;
                            }
                            ServerWorkerData new_worker_data = new ServerWorkerData(p_receive_from_worker_construct, p_server_pulse_object, new RemoveWorker(p_all_workers_data.Remove));
                            int    new_thread_id             = HelperFunctions.GetGUID();
                            Thread new_worker_thread         = new Thread(() => WorkerThread.WorkerMainThread(new_worker_data, port_num, new_thread_id, p_all_workers_data_lock, p_server_ip_address));
                            lock (p_all_workers_data_lock)
                            {
                                p_all_workers_data.Add(new_thread_id, new KeyValuePair <Thread, ServerWorkerData>(new_worker_thread, new_worker_data));
                            }
                            new_worker_thread.Start();
                        }
                        else
                        {
                            p_workers_port_number_construct.workers_port_number_queue_flag = false;
                        }
                    }
                }
            }
        }