Click here to Skip to main content
15,898,222 members
Home / Discussions / C#
   

C#

 
GeneralRe: Password field in datagridview,C# Pin
sampath_dr20-Sep-09 21:21
sampath_dr20-Sep-09 21:21 
QuestionTiming Out the User Session Using the MouseMove Event Pin
Richard Andrew x6420-Sep-09 19:23
professionalRichard Andrew x6420-Sep-09 19:23 
AnswerRe: Timing Out the User Session Using the MouseMove Event Pin
Christian Graus20-Sep-09 19:39
protectorChristian Graus20-Sep-09 19:39 
Questionreducing image file size Pin
michael@cohen20-Sep-09 19:09
michael@cohen20-Sep-09 19:09 
AnswerRe: reducing image file size Pin
Christian Graus20-Sep-09 19:41
protectorChristian Graus20-Sep-09 19:41 
AnswerRe: reducing image file size Pin
Luc Pattyn21-Sep-09 1:01
sitebuilderLuc Pattyn21-Sep-09 1:01 
Questionhow to count printed total pages [modified] Pin
scoket20-Sep-09 17:48
scoket20-Sep-09 17:48 
QuestionThread scheduling [modified] Pin
Kwonhyung Roh20-Sep-09 16:58
Kwonhyung Roh20-Sep-09 16:58 
Hi,

Please help me on the thread scheduling problem described below.

The method Play() plays a sound file using WMPLib and
the method DoSomething() does some kind of time consuming tasks (just for testing).

I wonder why the two cases below showed me different results in spite of using thread for asynchronous processing.
It's been killing me...Confused | :confused:
public void Play()
{
     player.controls.stop();
     player.currentMedia = player.newMedia(path);
     player.controls.play();
}

public void DoSomething()
{
     int z = 1;
     for(int i=0; i<1000000; i++) {
         z = i + 1000;
         z = z - 1000;
         string str = "Test String";
         str = str + " What's up?";
     }
     MessageBox.Show("Something done");
}

// Case 1: Asynchronous processing
// Signature of DoSomething --> public void DoSomething(Object state)
private void button1_Click(object sender, EventArgs e)
{
     // Get full path of sound file here.
     Play();
     ThreadPool.QueueUserWorkItem(new WaitCallback(DoSomething));
}

// Case 2: Synchronous processing
// Signature of Play --> public void Play(Object state)
private void button2_Click(object sender, EventArgs e)
{
     // Get full path of sound file here.
     ThreadPool.QueueUserWorkItem(new WaitCallback(Play));
     DoSomething();
}


Thanks in advance.
Roh

modified on Monday, September 21, 2009 10:37 PM

AnswerRe: Thread scheduling Pin
Dave Kreskowiak20-Sep-09 17:02
mveDave Kreskowiak20-Sep-09 17:02 
GeneralRe: Thread scheduling Pin
Kwonhyung Roh20-Sep-09 18:15
Kwonhyung Roh20-Sep-09 18:15 
GeneralRe: Thread scheduling Pin
Dave Kreskowiak21-Sep-09 2:11
mveDave Kreskowiak21-Sep-09 2:11 
GeneralRe: Thread scheduling Pin
Kwonhyung Roh21-Sep-09 17:31
Kwonhyung Roh21-Sep-09 17:31 
GeneralRe: Thread scheduling Pin
Dave Kreskowiak22-Sep-09 4:30
mveDave Kreskowiak22-Sep-09 4:30 
GeneralRe: Thread scheduling Pin
Kwonhyung Roh22-Sep-09 16:14
Kwonhyung Roh22-Sep-09 16:14 
QuestionError using tao framework Pin
billy_iii20-Sep-09 11:42
billy_iii20-Sep-09 11:42 
AnswerRe: Error using tao framework Pin
Henry Minute20-Sep-09 12:40
Henry Minute20-Sep-09 12:40 
GeneralRe: Error using tao framework Pin
billy_iii20-Sep-09 13:23
billy_iii20-Sep-09 13:23 
GeneralRe: Error using tao framework Pin
Dave Kreskowiak20-Sep-09 16:59
mveDave Kreskowiak20-Sep-09 16:59 
AnswerRe: Error using tao framework Pin
carlecomm29-Sep-09 1:25
carlecomm29-Sep-09 1:25 
QuestionCorsor position Pin
Muammar©20-Sep-09 10:29
Muammar©20-Sep-09 10:29 
AnswerRe: Corsor position Pin
Abhishek Sur20-Sep-09 10:32
professionalAbhishek Sur20-Sep-09 10:32 
AnswerRe: Corsor position Pin
Luc Pattyn20-Sep-09 11:01
sitebuilderLuc Pattyn20-Sep-09 11:01 
GeneralRe: Corsor position Pin
Muammar©20-Sep-09 11:18
Muammar©20-Sep-09 11:18 
GeneralRe: Corsor position Pin
Daniel Grunwald20-Sep-09 13:19
Daniel Grunwald20-Sep-09 13:19 
GeneralRe: Corsor position Pin
Luc Pattyn20-Sep-09 13:54
sitebuilderLuc Pattyn20-Sep-09 13:54 

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.