Click here to Skip to main content
15,915,702 members
Home / Discussions / C#
   

C#

 
AnswerRe: atomic operation of reference assignment? Pin
Guffa27-May-08 4:30
Guffa27-May-08 4:30 
GeneralRe: atomic operation of reference assignment? Pin
George_George27-May-08 23:54
George_George27-May-08 23:54 
GeneralRe: atomic operation of reference assignment? Pin
supercat910-Jul-08 7:07
supercat910-Jul-08 7:07 
AnswerRe: atomic operation of reference assignment? Pin
Guffa10-Jul-08 16:15
Guffa10-Jul-08 16:15 
GeneralRe: atomic operation of reference assignment? Pin
supercat910-Jul-08 18:21
supercat910-Jul-08 18:21 
AnswerRe: atomic operation of reference assignment? Pin
Zoltan Balazs27-May-08 4:46
Zoltan Balazs27-May-08 4:46 
GeneralRe: atomic operation of reference assignment? Pin
George_George27-May-08 23:55
George_George27-May-08 23:55 
QuestionHow to keep track of background threads? Pin
ptr2void27-May-08 3:09
ptr2void27-May-08 3:09 
I have two threads, one UI thread and one Background thread..

I want to keep a track of the background thread so that I may kill my UI thread (a tray icon) when the background thread has finished...
Please keep in mind mine is a console application.

Please review my code for more details..

class Program
    {
        static void Main(string[] args)
        {
            Thread[] threads = new Thread[2];
            threads[0] = new Thread(new ThreadStart(UIMethod));
            threads[1] = new Thread(new ThreadStart(BackGroundMethod));
            threads[0].SetApartmentState(ApartmentState.STA);
            threads[0].Start();
            threads[1].Start();
            /*What should I write here so that I know when
BackGroundMethod has finished
, I can kill my system tray icon*/
        }
        public static void UIMethod()
        {
            /*Generate the system tray*/
               Tray obj = new Tray();	
	obj.GenerateTrayIcon();
	Application.Run();
        }
        public static void BackGroundMethod()
        {
            /*Do some heavy background work..*/
        }
    }


Any suggestions with some code would be highly appreciated..

Thanks.
AnswerRe: How to keep track of background threads? Pin
N a v a n e e t h27-May-08 3:12
N a v a n e e t h27-May-08 3:12 
GeneralRe: How to keep track of background threads? Pin
ptr2void27-May-08 3:15
ptr2void27-May-08 3:15 
GeneralRe: How to keep track of background threads? Pin
N a v a n e e t h27-May-08 3:18
N a v a n e e t h27-May-08 3:18 
GeneralRe: How to keep track of background threads? Pin
ptr2void27-May-08 3:24
ptr2void27-May-08 3:24 
GeneralRe: How to keep track of background threads? Pin
N a v a n e e t h27-May-08 3:41
N a v a n e e t h27-May-08 3:41 
GeneralRe: How to keep track of background threads? Pin
ptr2void27-May-08 3:52
ptr2void27-May-08 3:52 
GeneralRe: How to keep track of background threads? Pin
supercat912-Jul-08 12:21
supercat912-Jul-08 12:21 
QuestionWord Plug-in eventhandlers stops working... Pin
Anders Molin27-May-08 3:00
professionalAnders Molin27-May-08 3:00 
QuestionSetting values for anonymous types Pin
Yoyosch27-May-08 2:34
Yoyosch27-May-08 2:34 
AnswerRe: Setting values for anonymous types Pin
Colin Angus Mackay27-May-08 3:13
Colin Angus Mackay27-May-08 3:13 
QuestionHow to block popups in broswer component? Pin
asma_panjabi27-May-08 2:14
asma_panjabi27-May-08 2:14 
AnswerRe: How to block popups in broswer component? Pin
buchstaben27-May-08 5:22
buchstaben27-May-08 5:22 
GeneralRe: How to block popups in broswer component? Pin
asma_panjabi27-May-08 22:38
asma_panjabi27-May-08 22:38 
AnswerRe: How to block popups in broswer component? Pin
asma_panjabi29-May-08 0:38
asma_panjabi29-May-08 0:38 
QuestionDependency injection - Static properties Pin
N a v a n e e t h27-May-08 1:59
N a v a n e e t h27-May-08 1:59 
AnswerRe: Dependency injection - Static properties Pin
Pete O'Hanlon27-May-08 2:08
mvePete O'Hanlon27-May-08 2:08 
GeneralRe: Dependency injection - Static properties Pin
N a v a n e e t h27-May-08 2:11
N a v a n e e t h27-May-08 2:11 

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.