View Full Version : Xin Thinh Giao Cac Cao Thu Dich Thuat Cai
van_chi_la_ga_thoi
10-05-2004, 08:51 PM
Please Del ....
MinhKhánh
11-05-2004, 03:19 PM
Originally posted by van_chi_la_ga_thoi@May 10 2004, 06:51 PM
Please Del ....
Bác Gà làm sao thế ạ.
?
Cụ thể hơn tí đi bác.Anh em tò mò quá.
emcodon84
11-05-2004, 06:36 PM
Bác gà cả ngày chỉ có mỗi việc duyệt web, đọc hết story đến e-book, hết chinh trị xã hội, văn hoá, văn nghệ ....đến sức khoẻ sinh sản nên đâm ra lú, lẩn, rỗi, hơi... thì mới thành ra như vậy. Bác nên sinh hoạt một cách điều độ và lành mạnh cho nó thoải mái ra một chút.
van_chi_la_ga_thoi
11-05-2004, 07:09 PM
To Minh Khanh : Hom truoc anh dang dinh nho , May cao thu dich ho anh bai tho, Nhung ma anh nho duoc roai, voi lai cai context cua bai tho hoi rieng tu mot chut nen anh khong muon Public len nua...Sang nay anh vua Kill no song...
To Em co Don : Ong chi duoc cai noi dung thoi, Dan IT thang nao cha the, Ong la dan Dien tu ma con the nua la....Nhung ma vay cung suong di, Len Web free, Just one click La ca the gioi nay hien ra....Suong vai
Noi The nhieu luc kho bo mia, Dang lam cai su ly song song...Dau het ca dau...Search tren web duoc cai Sample cu chu'i. Cha lam deck gi duoc....Du an thi sap Deadline....
http://img40.photobucket.com/albums/v124/pqchinhtin3/chinhpq1234.jpg
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Threading;
namespace ThreadSync01
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
m_mre = new ManualResetEvent(false);
m_mreB = new ManualResetEvent(false);
m_mre_array = new ManualResetEvent[2];
m_mre_array[0]=m_mre;
m_mre_array[1]=m_mreB;
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void pose( bool posing )
{
if( posing )
{
if (components != null)
{
components.pose();
}
}
try
{
base.pose( posing );
}
catch
{
//I had to do this cause this kept raising exceptions.
//The reason was that the threads were still active.
//The solution in a real life situation would be use
//an event here to wait till all threads are finished.
//Ironic that an example program for a thread sync
//mechanism does not use any thread sync --- Nish
}
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.listBox1 = new System.Windows.Forms.ListBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// listBox1
//
this.listBox1.Location = new System.Drawing.Point(16, 16);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(272, 212);
this.listBox1.TabIndex = 0;
//
// button1
//
this.button1.Location = new System.Drawing.Point(16, 248);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(72, 24);
this.button1.TabIndex = 1;
this.button1.Text = "Try1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(112, 248);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(72, 24);
this.button2.TabIndex = 2;
this.button2.Text = "Try2";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(216, 248);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(72, 24);
this.button3.TabIndex = 3;
this.button3.Text = "Try3";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(306, 288);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.button3,
this.button2,
this.button1,
this.listBox1});
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "Form1";
this.Text = "ThreadSync01";
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[MTAThread]
static void Main()
{
try
{
Application.Run(new Form1());
}
catch
{
//same explanation as in pose(...) - Nish
}
}
public int m_x=0;
public void ReadThread10()
{
int a = 10;
for(int y=0;y<5;y++)
{
string s = "ReadThread10";
s = s + " # multiplier= ";
s = s + Convert.ToString(a) + " # ";
s = s + a * m_x;
listBox1.Items.Add(s);
Thread.Sleep(1000);
}
}
public void ReadThread20()
{
int a = 20;
for(int y=0;y<5;y++)
{
string s = "ReadThread20";
s = s + " # multiplier= ";
s = s + Convert.ToString(a) + " # ";
s = s + a * m_x;
listBox1.Items.Add(s);
Thread.Sleep(1000);
}
}
public void WriteThread()
{
Thread.Sleep(1000);
m_x=3;
}
public void SafeWriteThread()
{
m_mre.Reset();
WriteThread();
m_mre.Set();
}
public void SafeWriteThreadB()
{
m_mreB.Reset();
m_mre.WaitOne();
Thread.Sleep(1000);
m_x+=3;
m_mreB.Set();
}
public void SafeReadThread10()
{
m_mre.WaitOne();
ReadThread10();
}
public void SafeReadThread20()
{
m_mre.WaitOne();
ReadThread20();
}
public void SafeReadThread10B()
{
WaitHandle.WaitAll(m_mre_array);
ReadThread10();
}
public void SafeReadThread20B()
{
WaitHandle.WaitAll(m_mre_array);
ReadThread20();
}
private void button1_Click(object sender, System.EventArgs e)
{
listBox1.Items.Clear();
listBox1.Items.Add("No sync mechanism used");
listBox1.Items.Add("");
Thread t0 = new Thread(new ThreadStart(WriteThread));
Thread t1 = new Thread(new ThreadStart(ReadThread10));
Thread t2 = new Thread(new ThreadStart(ReadThread20));
t0.IsBackground=true;
t1.IsBackground=true;
t2.IsBackground=true;
t0.Start();
t1.Start();
t2.Start();
}
private void button2_Click(object sender, System.EventArgs e)
{
listBox1.Items.Clear();
listBox1.Items.Add("One Write thread - Multiple Read threads");
listBox1.Items.Add("");
Thread t0 = new Thread(new ThreadStart(SafeWriteThread));
Thread t1 = new Thread(new ThreadStart(SafeReadThread10));
Thread t2 = new Thread(new ThreadStart(SafeReadThread20));
t0.IsBackground=true;
t1.IsBackground=true;
t2.IsBackground=true;
t0.Start();
t1.Start();
t2.Start();
}
public ManualResetEvent m_mre;
public ManualResetEvent m_mreB;
public ManualResetEvent[] m_mre_array;
private void button3_Click(object sender, System.EventArgs e)
{
listBox1.Items.Clear();
listBox1.Items.Add("Multiple Write threads - Multiple Read threads");
listBox1.Items.Add("");
Thread t0 = new Thread(new ThreadStart(SafeWriteThread));
Thread t0B = new Thread(new ThreadStart(SafeWriteThreadB));
Thread t1 = new Thread(new ThreadStart(SafeReadThread10B));
Thread t2 = new Thread(new ThreadStart(SafeReadThread20B));
t0.IsBackground=true;
t0B.IsBackground=true;
t1.IsBackground=true;
t2.IsBackground=true;
t0.Start();
t0B.Start();
t1.Start();
t2.Start();
}
}
}
van_chi_la_ga_thoi
11-05-2004, 07:38 PM
Thoi da vao day thi buon dua le vay...De khi nao can Ga` ta lai nho tiep nha...
Buon cai :
Oi the la mua he , hom nay ra duong thay hoa Phuong no ,
http://img40.photobucket.com/albums/v124/pqchinhtin3/DSC01855.jpg
Ơ Ơ hoa luc binh cung dep...
http://img40.photobucket.com/albums/v124/pqchinhtin3/DSC01635.jpg
Het chuyen.... :D
traudat
12-05-2004, 08:57 PM
Hi hi bây giờ mới biết vẫn chỉ là gà thôi là thằng nào :D chào cái nhé. Ông thông cảm tôi mới tham gia được 1 tý thôi chả biết đứa nào cả :D
Chào cái nhé :D
:-" :-" :-"
van_chi_la_ga_thoi
13-05-2004, 08:10 PM
Hơ hơ trau dat co phai la may ong ban cu khong day... neu phai thi la ai day ???
Ma hinh nhu traudat la con gai hay sao....Con trai sao lai chang moi ta di uong ruoi a`, chi chao the thoi uh....
:D
B) :ph34r:
Chao than ai va quyet thang...
traudat
13-05-2004, 10:59 PM
Hơ hơ trau dat co phai la may ong ban cu khong day... neu phai thi la ai day ???
Trời ông chinh chiến ở trong này nhiều mà không biết tôi hả ? chán thiệt :( :P he he nhìn cái là biết ngay :))
Ma hinh nhu traudat la con gai hay sao....Con trai sao lai chang moi ta di uong ruoi a`, chi chao the thoi uh....
mà vì sao lại cho tui là con gái [-( :angry: chuối vừa vừa thôi nhé [-x he he mời ông uống rượu thì vô tư thôi, nhưng hiện tại thì không được rùi :((
:x :-"