Hilos C#
Publicado por xrl8 (1 intervención) el 30/04/2021 19:12:17
Trato de hacer un Join en mi programa de Hilos, pero cuando lo hago el programa se congela no me permite seleccionar ningun boton o nada y si se lo quito corre perfectamente ya trate varias formas de ejecutarlo pero ninguna me ha dado, alguien tiene una idea que podria hacer?'
tambien he tratado de dejarlo por si solo y nada, me da el mismo error
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Collections.Generic;
using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;namespace ExamI
{ public partial class Form1 : Form { //Thread hilo;delegate void delegado(int valor);
public Form1()
{InitializeComponent();
}private void button1_Click(object sender, EventArgs e)
{Thread hilo = new Thread(new ThreadStart(Proceso1));
Thread hilo2 = new Thread(new ThreadStart(Proceso2));
hilo.Start();
//try
{hilo.Join();
}catch
{MessageBox.Show("Error al Generar Hilo");
}hilo2.Start();
tambien he tratado de dejarlo por si solo y nada, me da el mismo error
1
2
3
4
5
6
7
8
Thread hilo = new Thread(new ThreadStart(Proceso1));
Thread hilo2 = new Thread(new ThreadStart(Proceso2));
hilo.Start();
hilo.Join();
hilo2.Start();
Valora esta pregunta


0
