By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,524 Members | 1,589 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,524 IT Pros & Developers. It's quick & easy.

Using Class's and multiThreading

P: n/a
Hi All,

Just going into the world of Multithreading and have a few questions about
using class's in them.

If I create a calls in the main thread then start a new thread that calls
another class can i use the class that i created in the main thread? It does
work but not sure if this is the correct way to do it.

Or should I create a new class in the class that was created by the new
thread?

Also can you use vars from the main thread in the new thread or should i
only use vars that are created in the new thread? i.e. dimmed in the new
thread class.

Hope that makes sense.

Thanks
James
Mar 29 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

James wrote:
Hi All,

Just going into the world of Multithreading and have a few questions about
using class's in them.

If I create a calls in the main thread then start a new thread that calls
another class can i use the class that i created in the main thread? It does
work but not sure if this is the correct way to do it.

Or should I create a new class in the class that was created by the new
thread?

Also can you use vars from the main thread in the new thread or should i
only use vars that are created in the new thread? i.e. dimmed in the new
thread class.


You can use whatever accessible objects and variable you like, but you
must take care to synchronize access to them.

The best advice I can give you on entering the world of Multithreading
would be to read Jon Skeet's threading pages (in C#) at
<http://www.yoda.arachsys.com/csharp/threads/>, twice :)

--
Larry Lard
Replies to group please

Mar 29 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.