Blue Theme Orange Theme Green Theme Red Theme
 
Skip Navigation Links
C# Corner Home
Forum Home
Latest 50
Unanswered
Win $500 Cash
All Time Leaders
Jump to CategoryExpand Jump to Category
Login 
    Welcome Guest!
 Search Forum For :  
X
 Login
Please login to submit a new post, reply and edit exiting posts, see user profiles, and access more features. If you are not a registered member, Register here.
User Id:
Password:  
Forgot Password | Forgot UserName
   Home » C# Language » C# instance (of a class) and threading or BackgroundWorker
       
Author Reply
Elina
posted 3 posts
since Nov 07, 2009 
from

 C# instance (of a class) and threading or BackgroundWorker
  Posted on: 11/7/2009 2:59:57 PM       
hello

I'm looking to to have my instances of an object run asynchronously, e.g. do work at the same time

how would I go about doing this? I know how to make a thread inside one class and have it execute one function over and over, but my class has many functions within and I need to make the whole class run inside a thread.

any help greatly appreciated! thanks! :D
Sam Hobbs
posted  154 posts
since  Sep 07, 2009 
from 

 Re: C# instance (of a class) and threading or BackgroundWorker
  Posted on: 11/7/2009 3:03:01 PM       
You say your "class has many functions"; what determines what executed when? Does the class execute the various member functions or do the need to be executed from outside the thrad?
Elina
posted  3 posts
since  Nov 07, 2009 
from 

 Re: C# instance (of a class) and threading or BackgroundWorker
  Posted on: 11/7/2009 3:09:22 PM       
Yes, the class has many methods. And the class itself executes all the methods from within itself.

The class does not talk to the window which is Form1, that is done by a thread which polls the classes for new messages (if instance[0].messageQueue.Count > 0) in that fashion

so they are independent, and independet from eachother as well

just need them to run simultaneously so I don't need to run multiple copies of the software
Sam Hobbs
posted  154 posts
since  Sep 07, 2009 
from 

 Re: C# instance (of a class) and threading or BackgroundWorker
  Posted on: 11/7/2009 3:35:39 PM       
Sorry, I still don't understand what you need to do; I hope others do.
Elina
posted  3 posts
since  Nov 07, 2009 
from 

 Re: C# instance (of a class) and threading or BackgroundWorker
  Posted on: 11/7/2009 4:02:52 PM       
well, I have multiple instances of a class

currently they run after each other

I need them to run with each other, at the same time
Danatas Gervi
posted  194 posts
since  Jul 28, 2009 
from 

 Re: C# instance (of a class) and threading or BackgroundWorker
  Posted on: 11/8/2009 3:23:50 AM       

How many instances of classes do you have?

Sam Hobbs
posted  154 posts
since  Sep 07, 2009 
from 

 Re: C# instance (of a class) and threading or BackgroundWorker
  Posted on: 11/8/2009 6:30:43 PM       
Yes, that is what asychronous means. I understood that part.
       
Developer-Ready ASP.NET 2.0 Web Hosting with 3 MONTHS FREE
Now supporting .NET 3.0 Framework with Windows Workflow Foundation, Windows Communication Foundation (WCF), Windows Presentation Foundation (WPF), windows CardSpace (WCS)! Providing more flexibility for Developers with Web Services Support and a User/Permission Manger. Also supporting MS SQL 2005/2000 with Real-Time Backups, FREE Automated Attach .MDF Tool, FREE SQL Restore and Shrink SQL DB Tools, and SQL
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Clickatell's SMS Gateway
Clickatell's Developer Solutions allow you to SMS enable any website or application via a range of API's. Learn More about our API connections.
Free access to .NET Memory Management video
Everything you need to know about Garbage Collection, Temporary Objects, Fragmentation, Finalization and common causes of memory leaks in .NET. Watch the video here.
Microsoft Visual Studio 2010
Microsoft Visual Studio 2010 offers more to developers than any other Visual Studio release. Work more productively and collaboratively-with greater control over your work at every step. The Beta 2 can give you a head start on achieving efficiency.

 Hosted by MaximumASP  |  Found a broken link?  |  Contact Us  |  Terms & conditions  |  Privacy Policy  |  Site Map  |  Advertise with us
Current Version: 3.2009.8.27
 © 1999 - 2009  Mindcracker LLC. All Rights Reserved