|
-
Jan 30th, 2010, 10:36 AM
#1
Thread Starter
Member
something else besides threads?
For this program im using http method post to recieve messages from the server, when its waiting for a new message to be sent it locks the program up. No biggie, ill just thread the sub... Bad idea... I also have functions "send", "Connect", "disconnect". All on threads... i looked at task manager it started getting up to 100+ threads. I dont know much about threads but that just seems way to much. they will die off and the count will return to 20 but id like to find a different way of keeping the program from locking up but not having 100+ threads..
Little off topic:
i used a user control. The only problem now is on the tab, its not anchored with the rest of the form... how do i accomplish this?
-
Jan 30th, 2010, 03:05 PM
#2
Hyperactive Member
Re: something else besides threads?
Is this some kind of website project ? Please post your code and the problem.
-
Jan 30th, 2010, 03:08 PM
#3
Thread Starter
Member
Re: something else besides threads?
its for a chat service. i felt like making a desktop program for it. and when i use the code to receive new messages it will freeze up the program. so i made it on a new thread. But it does it pretty often so theres alot of new threads being opened up. is there anyway to make it not freeze the program but not use threads?
-
Jan 30th, 2010, 04:45 PM
#4
Re: something else besides threads?
100 threads that are all waiting is not so bad. There are limits on some internal synchronization objects, but if all you are doing is sending off a request to somewhere and waiting for a reply, then you won't deal with so many synchronization objects. There are other ways, such as polling, but they all suck to a different degree. Threading makes sense if each thread is going to spend most of its lifetime waiting for something.
Of course, you could look into thread pooling so that the number of actual threads will be managed for you.
My usual boring signature: Nothing
 
-
Jan 30th, 2010, 06:39 PM
#5
Thread Starter
Member
Re: something else besides threads?
Yeah, when i call the sub it goes to http://www.site.com/events posting the users ID. So itll wait there untill there is actually a response. Nothing else besides that. Disconnect is instant, sent is instant. connect is semi instant. so the major threads wont be a problem? and ill look into thread pooling.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|