public ClientWorkerData(MessageReceivedInform p_message_received_inform, MainFormInvoke p_main_form_invoke, SendToWorkerConstruct p_send_to_worker_construct , ReceiveFromWorkerConstruct p_receive_from_worker_construct, object p_client_worker_pulse_object, ClientWorkerCancelConstruct p_cancel_construct) { message_received_inform = p_message_received_inform; main_form_invoke = p_main_form_invoke; send_to_worker_construct = p_send_to_worker_construct; receive_from_worker_construct = p_receive_from_worker_construct; client_worker_pulse_object = p_client_worker_pulse_object; cancel_construct = p_cancel_construct; }
private static void AddNewTransferMiniThread(MessageFromWorker p_message_from_worker, ReceiveFromWorkerConstruct p_receive_from_worker_construct , MessageReceivedInform p_message_received_inform, MainFormInvoke p_main_form_invoke, Dictionary <int, Thread> p_all_mini_threads , object p_all_mini_threads_lock) { int new_mini_thread_id = HelperFunctions.GetGUID(); Thread new_mini_thread = new Thread(() => TransferDataToForm(p_message_from_worker, p_receive_from_worker_construct, p_message_received_inform , p_main_form_invoke, new_mini_thread_id, p_all_mini_threads, p_all_mini_threads_lock)); lock (p_all_mini_threads_lock) { p_all_mini_threads.Add(new_mini_thread_id, new_mini_thread); } new_mini_thread.Start(); }
private static void TransferDataToForm(MessageFromWorker p_message_from_worker, ReceiveFromWorkerConstruct p_receive_from_worker_construct , MessageReceivedInform p_message_received_inform, MainFormInvoke p_main_form_invoke, int p_mini_thread_id, Dictionary <int, Thread> p_all_mini_threads , object p_all_mini_threads_lock) { lock (p_receive_from_worker_construct.receive_from_worker_queue_lock) { p_receive_from_worker_construct.receive_from_worker_queue.Enqueue(p_message_from_worker); p_receive_from_worker_construct.receive_from_worker_queue_flag = true; } p_main_form_invoke(p_message_received_inform); lock (p_all_mini_threads_lock) { p_all_mini_threads.Remove(p_mini_thread_id); } Thread.CurrentThread.Abort(); return; }