Results 1 to 5 of 5

Thread: something else besides threads?

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2009
    Posts
    49

    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?

  2. #2
    Hyperactive Member nepalbinod's Avatar
    Join Date
    Sep 2007
    Posts
    293

    Re: something else besides threads?

    Is this some kind of website project ? Please post your code and the problem.

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2009
    Posts
    49

    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?

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    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

  5. #5

    Thread Starter
    Member
    Join Date
    Oct 2009
    Posts
    49

    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
  •  



Click Here to Expand Forum to Full Width