Click here to Skip to main content
15,905,419 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to connect to MS Access database that is plased on a hosting server using C# Pin
sher_azam2-Dec-09 19:33
sher_azam2-Dec-09 19:33 
GeneralRe: How to connect to MS Access database that is plased on a hosting server using C# Pin
Calla2-Dec-09 21:37
Calla2-Dec-09 21:37 
Question(NegotiateStream) The server has rejected the client credentials Pin
abiemann1-Dec-09 22:30
abiemann1-Dec-09 22:30 
AnswerRe: (NegotiateStream) The server has rejected the client credentials Pin
abiemann2-Dec-09 7:18
abiemann2-Dec-09 7:18 
QuestionUnexpected Errors in Multithreading Pin
Razanust1-Dec-09 21:35
Razanust1-Dec-09 21:35 
AnswerRe: Unexpected Errors in Multithreading Pin
Calla1-Dec-09 21:37
Calla1-Dec-09 21:37 
AnswerRe: Unexpected Errors in Multithreading Pin
Richard MacCutchan1-Dec-09 21:40
mveRichard MacCutchan1-Dec-09 21:40 
Questionhow to waiti for specific events that occurs Pin
Ronenb1-Dec-09 21:30
Ronenb1-Dec-09 21:30 
I’ve using a Queue to store data and I do polling in order to know if the Queue contain data ( that I understand is not the correct approach)

For Example

private void PopDataFromQueue()
{
bool isRspOK;
byte [] data;
while (true)
{

//If so then stop the thread
if (m_isStopReadingQueueThread == true)
break;

if (m_queue.Count > 0)
{
lock (m_queue)
{
if (m_queue.Count > 0)
{
data = (byte [])m_queue.Dequeue();
isRspOK = m_scenario.Parse(sockBuf.SocketData);
if (isRspOK == true)
{
;
}
}
}
}
}


I need to implement approach that wait for event occur and not always check the Queue status

The function PopDataFromQueue is define as a thread

Something like this
private void PopDataFromQueue()
{
//create timer event that indicate in case the event that I waiting for not reach after some time , need to handle it
Timer timer = new timer(1000);
while (true)
{

//If so then stop the thread
if (m_isStopReadingQueueThread == true)
break;

Event = WaitForEvent(Queue.Add,Timer. expire); // need to wait for two type of events
Switch(Event)
{

case Queue.Dataexist:
data = (byte [])m_queue.Dequeue();
isRspOK = m_scenario.Parse(sockBuf.SocketData);
if (isRspOK == true)
{
;
}
Break;
Case timer.expire:
isStopReadingQueueThread =true;
break;

}
}
}

I try to look in the net and I didn’t found
Any advice?

Thanks
Ronen
AnswerRe: how to waiti for specific events that occurs Pin
freakyit1-Dec-09 22:55
freakyit1-Dec-09 22:55 
AnswerRe: how to waiti for specific events that occurs Pin
abiemann2-Dec-09 7:37
abiemann2-Dec-09 7:37 
QuestionHow to check a groupbox for checked radiobuttons dynamicaly Pin
gwithey1-Dec-09 21:16
gwithey1-Dec-09 21:16 
AnswerRe: How to check a groupbox for checked radiobuttons dynamicaly Pin
dan!sh 1-Dec-09 21:49
professional dan!sh 1-Dec-09 21:49 
GeneralRe: How to check a groupbox for checked radiobuttons dynamicaly Pin
gwithey1-Dec-09 21:53
gwithey1-Dec-09 21:53 
GeneralRe: How to check a groupbox for checked radiobuttons dynamicaly Pin
freakyit1-Dec-09 22:06
freakyit1-Dec-09 22:06 
GeneralRe: How to check a groupbox for checked radiobuttons dynamicaly Pin
gwithey1-Dec-09 22:41
gwithey1-Dec-09 22:41 
GeneralRe: How to check a groupbox for checked radiobuttons dynamicaly Pin
gwithey1-Dec-09 22:20
gwithey1-Dec-09 22:20 
GeneralRe: How to check a groupbox for checked radiobuttons dynamicaly Pin
freakyit1-Dec-09 22:39
freakyit1-Dec-09 22:39 
GeneralRe: How to check a groupbox for checked radiobuttons dynamicaly Pin
gwithey1-Dec-09 22:50
gwithey1-Dec-09 22:50 
GeneralRe: How to check a groupbox for checked radiobuttons dynamicaly Pin
freakyit1-Dec-09 22:57
freakyit1-Dec-09 22:57 
GeneralRe: How to check a groupbox for checked radiobuttons dynamicaly Pin
gwithey1-Dec-09 23:08
gwithey1-Dec-09 23:08 
QuestionOpen a text file in Notepad Pin
Hardus Lombaard1-Dec-09 21:12
Hardus Lombaard1-Dec-09 21:12 
AnswerRe: Open a text file in Notepad Pin
Calla1-Dec-09 21:19
Calla1-Dec-09 21:19 
AnswerRe: Open a text file in Notepad Pin
Luc Pattyn2-Dec-09 1:14
sitebuilderLuc Pattyn2-Dec-09 1:14 
GeneralRe: Open a text file in Notepad Pin
Hardus Lombaard20-Jul-10 22:09
Hardus Lombaard20-Jul-10 22:09 
Questiontruncate all data tables Pin
akram30021-Dec-09 20:33
akram30021-Dec-09 20:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.