Click here to Skip to main content
15,906,645 members
Home / Discussions / C#
   

C#

 
AnswerRe: API & DLL Pin
Tormod Fjeldskaar8-Aug-07 21:51
Tormod Fjeldskaar8-Aug-07 21:51 
GeneralRe: API & DLL Pin
Renuka Rajamanickam8-Aug-07 23:02
Renuka Rajamanickam8-Aug-07 23:02 
QuestionConversion Pin
M. J. Jaya Chitra8-Aug-07 21:22
M. J. Jaya Chitra8-Aug-07 21:22 
AnswerRe: Conversion Pin
Talal Sultan8-Aug-07 21:36
Talal Sultan8-Aug-07 21:36 
Questioncan we force dot matrix printer to Start the Printing from the Begining of the next page for every printout ? Pin
help as an alias8-Aug-07 21:11
help as an alias8-Aug-07 21:11 
AnswerRe: can we force dot matrix printer to Start the Printing from the Begining of the next page for every printout ? Pin
Mark Churchill16-Aug-07 15:51
Mark Churchill16-Aug-07 15:51 
GeneralRe: can we force dot matrix printer to Start the Printing from the Begining of the next page for every printout ? Pin
help as an alias16-Aug-07 17:59
help as an alias16-Aug-07 17:59 
QuestionAdding Macro through C# Pin
hirennn8-Aug-07 20:47
hirennn8-Aug-07 20:47 
AnswerRe: Adding Macro through C# Pin
Paul Conrad16-Aug-07 15:54
professionalPaul Conrad16-Aug-07 15:54 
QuestionHow to rum C# Programe? Pin
asprajesh8-Aug-07 20:42
asprajesh8-Aug-07 20:42 
AnswerRe: How to rum C# Programe? Pin
Talal Sultan8-Aug-07 20:59
Talal Sultan8-Aug-07 20:59 
GeneralRe: How to rum C# Programe? Pin
asprajesh8-Aug-07 21:08
asprajesh8-Aug-07 21:08 
QuestionCreate Exchange Server Plug-In or Windows Service in C# Pin
adnanrafiq8-Aug-07 20:36
adnanrafiq8-Aug-07 20:36 
Questionhow to make an expand All functionality for an XML file showing in a web browser Control [modified] Pin
Rocky#8-Aug-07 20:31
Rocky#8-Aug-07 20:31 
QuestionLastIndexOf("") in C# Pin
jayarajmrj8-Aug-07 20:05
jayarajmrj8-Aug-07 20:05 
AnswerRe: LastIndexOf("") in C# Pin
hamid_m8-Aug-07 20:19
hamid_m8-Aug-07 20:19 
AnswerRe: LastIndexOf("") in C# Pin
Vikram A Punathambekar8-Aug-07 21:45
Vikram A Punathambekar8-Aug-07 21:45 
AnswerRe: LastIndexOf("") in C# Pin
Luc Pattyn9-Aug-07 0:57
sitebuilderLuc Pattyn9-Aug-07 0:57 
QuestionWindows Form Pin
sangramkp8-Aug-07 19:37
sangramkp8-Aug-07 19:37 
AnswerRe: Windows Form Pin
Christian Graus8-Aug-07 19:41
protectorChristian Graus8-Aug-07 19:41 
QuestionSwitching between two threads Pin
praveen pandey8-Aug-07 18:48
praveen pandey8-Aug-07 18:48 
AnswerRe: Switching between two threads Pin
Leslie Sanford8-Aug-07 19:41
Leslie Sanford8-Aug-07 19:41 
praveen pandey wrote:
I am having two threads first one is main thread and second one a thread in which a function is called.In second thread,while loop is there.When one iteration is completed in loop i have to switch to main thread and call a function and again come to second thread and repeat the process.


You have the threads signal each other when control should pass from one to the other. While one thread is doing work, the other waits. When the work is finished, the working thread signals the waiting thread that it's done. It then begins waiting while the other thread does its work.

Typically, a worker thread looks something like this:

private void ThreadMethod()
{
    lock(lockObject)
    { 
        while(someConditionIsTrue)
        {
            Monitor.Wait(lockObject);
 
            // Do some work...
        }
    }
}


From another thread, you have to pulse the lock to get the worker thread running:

lock(lockObject)
{
    Monitor.Pulse(lockObject);
}


However, since one of these threads is the main thread, you probably don't want it blocking while the other thread is doing work. This could tie up your UI. So we need more information about the kind of application you're writing. Is it a console app? A Window Forms app?
GeneralRe: Switching between two threads Pin
praveen pandey8-Aug-07 19:55
praveen pandey8-Aug-07 19:55 
GeneralRe: Switching between two threads Pin
Leslie Sanford8-Aug-07 21:41
Leslie Sanford8-Aug-07 21:41 
GeneralRe: Switching between two threads Pin
praveen pandey8-Aug-07 23:51
praveen pandey8-Aug-07 23:51 

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.