Click here to Skip to main content
15,887,585 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I need to create Multithread
Like thread name 1,2,3.. - 100
when Thread 1 finished Thread 2 start Vice versa thread 100 ..is it possible to create??
Posted
Updated 31-Jul-13 3:57am
v2
Comments
Sergey Alexandrovich Kryukov 31-Jul-13 9:48am    
And how is it related to WPF? Do you understand separation of concerns?
—SA
KM Perumal 31-Jul-13 9:54am    
Do you know what is WPF???
Sergey Alexandrovich Kryukov 31-Jul-13 9:58am    
Who are you talking to?
—SA
Sushil Mate 31-Jul-13 12:57pm    
:-)
[no name] 31-Jul-13 9:54am    
"is it possible to create", yes. Yes it is possible.

1 solution

First of all, the main topic of the quesiton has nothing to do with WPF or any other UI, could be done with any.

More importantly, this is quite possible and would totally defeat the purpose of multithreading. More exactly, it would be equivalent to 1 thread instead of 100, when this 1 thread simply consequently call the body methods of those 100 would-be-threads, one at a time. There will be one difference: 1 thread would do it faster then 100, by an apparent reason: considerable overhead of creation and initialization of a thread execution. The idea can be implemented but makes no sense at all.

As to using threads in WPF, you might need to learn one thing. As you can only call any methods or properties related to the currently executing UI through only one, UI thread, and other threads cannot do it, you would need to know invocation technique which delegates the execution of UI-related code to UI thread, which is done via System.Windows.Threading.Dispatcher.Invoke or System.Windows.Threading.Dispatcher.BegingInvoke. Please see:
http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.aspx[^].

Please also see my past answers:
Control.Invoke() vs. Control.BeginInvoke()[^],
Problem with Treeview Scanner And MD5[^].

—SA
 
Share this answer
 
Comments
KM Perumal 31-Jul-13 10:06am    
Wow Super ...But need Multithread In WPF with Code behind C# Language
[no name] 31-Jul-13 10:11am    
I think your account got hacked. Member for 3 years, given solutions, and you are asking/making comments like this? So create a WPF application, and in your code behind create your threads, in this most unusual requirement. What exactly is the problem?
Sergey Alexandrovich Kryukov 31-Jul-13 11:03am    
Are you joking? I can see many members giving many tens of answers on this site (how good they are is the question :-), still having no clue at all in programming...

(KM Perumal, I'm not talking about you here...)

—SA
Sergey Alexandrovich Kryukov 31-Jul-13 11:02am    
There is no "code behind" in WPF, there is just code.
Why "but"? I answered on multithreading use with WPF, did you notice that?

So, please accept the answer formally (green button), or ask your follow-up questions (or both).
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900