Click to See Complete Forum and Search --> : Thread Synchonization Problems..
somu0915
March 6th, 2008, 01:26 AM
I am using threads for an application..
However I have a shared label which I am using to display results..
How to synchronise threads such that the label is accessible by only one thread at a time??
Please help..
somu0915
March 6th, 2008, 01:49 AM
Here is some code:
/*Here I call my display method*/
objListBox->Invoke(gcnew displayDelegate(this, &SearchFile::displayControls), objectParameters);
/*Here I am accessing two shared control - textbox and list box which needs to be synchronized*/
void SearchFile:: displayControls(Object^ objectParameters)
{
this->txtSearchPath->Text = val + " Files Found.." + " " + threadPath;
this->txtSearchPath->Update();
array<Object^>^ parameterArray = (array<Object^>^) objectParameters;
System::Windows::Forms::ListBox^ objListBox = (System::Windows::Forms::ListBox^)parameterArray[2];
objListBox->Items->Add("Application Name: " + threadPath->ToString());
if((bool)parameterArray[3] == true)
{
objListBox->Items->Add("Version: " + parameterProductVersion->ToString());
}
objListBox->TopIndex = objListBox->Items->Count -1 ;
}
Please help !!!!
Krishnaa
March 7th, 2008, 06:39 AM
Read this,
http://msdn2.microsoft.com/en-us/library/xd3st9c4(VS.80).aspx
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.