Click here to Skip to main content
15,891,033 members
Home / Discussions / C#
   

C#

 
GeneralRe: saving file problem Pin
Skippums22-Jan-08 15:44
Skippums22-Jan-08 15:44 
GeneralRe: saving file problem Pin
AliNajjar22-Jan-08 16:05
AliNajjar22-Jan-08 16:05 
GeneralRe: saving file problem Pin
Skippums23-Jan-08 4:36
Skippums23-Jan-08 4:36 
GeneralRe: saving file problem Pin
AliNajjar23-Jan-08 12:16
AliNajjar23-Jan-08 12:16 
GeneralJava/C# Interop Pin
Edmundisme22-Jan-08 12:45
Edmundisme22-Jan-08 12:45 
GeneralTelling a thread to do something. Pin
Clive D. Pottinger22-Jan-08 12:14
Clive D. Pottinger22-Jan-08 12:14 
GeneralRe: Telling a thread to do something. Pin
Luc Pattyn22-Jan-08 14:40
sitebuilderLuc Pattyn22-Jan-08 14:40 
GeneralRe: Telling a thread to do something. Pin
mav.northwind22-Jan-08 22:57
mav.northwind22-Jan-08 22:57 
In addition to what Luc said, you can influence what's happening inside your thread's procedure for example by setting properties of your object which in turn are used inside the thread procedure.
For example, your PanickyChicken class could have a property
public bool ThinksSkyIsFalling = false {get; set;}
(don't know if that's the correct C# 3.5 syntax, but I think you get the idea).
Now your chicken is wandering about until your program tells it that the sky is falling:
chickenLittle.ThinksSkyIsFalling = true;
Now inside your WanderAbout method you can execute the WarnAll method as soon as ThinksSkyIsFalling==true and then exit WanderAbout - chickenLittle's job is done.

But then you'll have to think about synchronization issues. In the example above I think there's not much that can go wrong without explicit synchronization, but when you're performing operations that can be interrupted by a thread switch, you'll definitely have to take care of these cases. The lock() instruction can come handy in these cases.

Regards,
mav

--
Black holes are the places where God divided by 0...

GeneralRe: Telling a thread to do something. Pin
Clive D. Pottinger23-Jan-08 3:43
Clive D. Pottinger23-Jan-08 3:43 
General(XNA!!!) Have Several Sprites of the Same Image, With Different Properties [modified] Pin
MasterSharp22-Jan-08 11:32
MasterSharp22-Jan-08 11:32 
GeneralRe: (XNA!!!) Have Several Sprites of the Same Image, With Different Properties Pin
MarkB77722-Jan-08 17:34
MarkB77722-Jan-08 17:34 
GeneralHelp with playing 24-bit audio Pin
kshet2622-Jan-08 11:31
kshet2622-Jan-08 11:31 
GeneralRaise event from DLL Pin
GeezerJoe22-Jan-08 11:15
GeezerJoe22-Jan-08 11:15 
GeneralDelete/Update MS Outlook appointments Pin
NewToAspDotNet22-Jan-08 10:10
NewToAspDotNet22-Jan-08 10:10 
Generalhandling multi-threading in C#.net 3.0 Pin
anumadhu22-Jan-08 9:31
anumadhu22-Jan-08 9:31 
GeneralRe: handling multi-threading in C#.net 3.0 Pin
Skippums22-Jan-08 10:40
Skippums22-Jan-08 10:40 
Generalstring Pin
simworld22-Jan-08 8:39
simworld22-Jan-08 8:39 
GeneralRe: string Pin
J$22-Jan-08 8:42
J$22-Jan-08 8:42 
GeneralRe: string Pin
NewToAspDotNet22-Jan-08 10:08
NewToAspDotNet22-Jan-08 10:08 
GeneralRe: string Pin
Scott Dorman22-Jan-08 17:56
professionalScott Dorman22-Jan-08 17:56 
GeneralRe: string Pin
simworld23-Jan-08 5:19
simworld23-Jan-08 5:19 
QuestionHow to send parameters to a running application? Pin
Gene Arnold22-Jan-08 8:19
Gene Arnold22-Jan-08 8:19 
AnswerRe: How to send parameters to a running application? Pin
Gene Arnold22-Jan-08 8:32
Gene Arnold22-Jan-08 8:32 
Generalget a BSTR from a vc++ dll to a c# string Pin
Calvin Streeting22-Jan-08 7:45
Calvin Streeting22-Jan-08 7:45 
GeneralRe: get a BSTR from a vc++ dll to a c# string Pin
led mike22-Jan-08 8:15
led mike22-Jan-08 8:15 

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.