Click here to Skip to main content
15,922,512 members
Home / Discussions / C#
   

C#

 
GeneralRe: Get a property from an internal .NET framework class Pin
PIEBALDconsult11-Sep-14 6:19
mvePIEBALDconsult11-Sep-14 6:19 
GeneralRe: Get a property from an internal .NET framework class Pin
Eddy Vluggen11-Sep-14 6:51
professionalEddy Vluggen11-Sep-14 6:51 
GeneralRe: Get a property from an internal .NET framework class Pin
OriginalGriff11-Sep-14 8:50
mveOriginalGriff11-Sep-14 8:50 
GeneralRe: Get a property from an internal .NET framework class Pin
Eddy Vluggen11-Sep-14 9:39
professionalEddy Vluggen11-Sep-14 9:39 
QuestionTX TextControl 21.0 Document viewer example in c# Pin
pitchaiyan11-Sep-14 3:44
pitchaiyan11-Sep-14 3:44 
QuestionRe: TX TextControl 21.0 Document viewer example in c# Pin
ZurdoDev11-Sep-14 4:27
professionalZurdoDev11-Sep-14 4:27 
AnswerRe: TX TextControl 21.0 Document viewer example in c# Pin
Dave Kreskowiak11-Sep-14 4:38
mveDave Kreskowiak11-Sep-14 4:38 
GeneralRe: TX TextControl 21.0 Document viewer example in c# Pin
PIEBALDconsult12-Sep-14 5:34
mvePIEBALDconsult12-Sep-14 5:34 
GeneralRe: TX TextControl 21.0 Document viewer example in c# Pin
Dave Kreskowiak12-Sep-14 5:39
mveDave Kreskowiak12-Sep-14 5:39 
QuestionHow to loop in timers Pin
Member 1107411510-Sep-14 21:02
Member 1107411510-Sep-14 21:02 
AnswerRe: How to loop in timers Pin
OriginalGriff10-Sep-14 21:52
mveOriginalGriff10-Sep-14 21:52 
GeneralRe: How to loop in timers Pin
Member 1107411510-Sep-14 22:02
Member 1107411510-Sep-14 22:02 
GeneralRe: How to loop in timers Pin
OriginalGriff10-Sep-14 22:09
mveOriginalGriff10-Sep-14 22:09 
GeneralRe: How to loop in timers Pin
Member 1107411510-Sep-14 22:41
Member 1107411510-Sep-14 22:41 
GeneralRe: How to loop in timers Pin
OriginalGriff10-Sep-14 22:57
mveOriginalGriff10-Sep-14 22:57 
GeneralRe: How to loop in timers Pin
Member 1107411524-Sep-14 19:56
Member 1107411524-Sep-14 19:56 
QuestionThreading issue Pin
SledgeHammer0110-Sep-14 10:23
SledgeHammer0110-Sep-14 10:23 
AnswerRe: Threading issue Pin
PIEBALDconsult10-Sep-14 11:29
mvePIEBALDconsult10-Sep-14 11:29 
GeneralRe: Threading issue Pin
SledgeHammer0110-Sep-14 12:14
SledgeHammer0110-Sep-14 12:14 
No, I want the app to NOT exit after spawning off threads...

1) main thread creates instance of Foo()
2) for (1..1000) Foo.Go() should be a fire and forget unit of work
3) main thread "exits", but only unit of work 1..30 were processed because the main thread exited too fast

What I want instead is:

1) main thread creates instance of Foo()
2) for (1..1000) Foo.Go() should be a fire and forget unit of work
3) main thread "exits", BUT "PROCESS HANGS" until all 1000 units of work are completed

I know I can do this with a .Join in the main thread, but as I said in my original post is that Foo() is its own man. If it wants to "block the process from exiting" until all the work is completed, it should do so without the main threads assistance.

Seems like when *Tasks* are running, they don't block the process from exiting
Seems like when a *Thread* object is running, it blocks the process from exiting

I kind of got something working, but I'm not super happy with it.

I kick off a Thread so the process is blocked from exiting... the background thread does a BlockingCollection.Take with a cancellation token. If the cancellation token is set, it exits the background thread.

Meanwhile, I also kick off a main thread watch dog task that checks if the main thread has exited and if it does, AND the queue is empty it sets the cancellation token so the background thread can exit.

It does have the behavior I want, but I'm not really liking this part:

Thread threadCurrent = Thread.CurrentThread;

Task.Run(() =>
{
if (System.Diagnostics.Debugger.IsAttached)
threadCurrent.Join();

Console.WriteLine("EXITED");

while (_queueLogEntries.Count > 0)
{
Thread.Sleep(100);
}

Console.WriteLine("EXITED2");

_cts.Cancel();
});
GeneralRe: Threading issue Pin
PIEBALDconsult10-Sep-14 15:18
mvePIEBALDconsult10-Sep-14 15:18 
Questionwebrowser control Pin
Member 1105956910-Sep-14 8:26
Member 1105956910-Sep-14 8:26 
AnswerRe: webrowser control Pin
Eddy Vluggen10-Sep-14 8:29
professionalEddy Vluggen10-Sep-14 8:29 
Generalwebrowser control Pin
Member 1105956910-Sep-14 8:42
Member 1105956910-Sep-14 8:42 
GeneralRe: webrowser control Pin
Eddy Vluggen10-Sep-14 9:57
professionalEddy Vluggen10-Sep-14 9:57 
GeneralRe: webrowser control Pin
Member 1105956912-Sep-14 9:50
Member 1105956912-Sep-14 9:50 

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.