Results 1 to 2 of 2

Thread: Limited number of threads at one time

  1. #1

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    Limited number of threads at one time

    I have a process that I run daily on a set of files. Each file can take up to a minute to go through the process. With 300 files, that can take up to like 12000000 minutes (or thereabouts). What I'd like to do is run several files at a time in different threads, but I don't want to bog down the machine that running the processes.

    I'd like a way to keep a queue of maybe 10 threads max running, and as each thread ends, the next one in line is started in its place. Anyone ever come across anything of that nature.

    I could probably come up with something myself, but I'm just too damn lazy. They say it happens in the autumn years, but I digress...

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Limited number of threads at one time

    When you create a ThreadPool class, the default set for the thread limit is 25. 25 is close to 10 and is a nice number. And it also addresses your issue.

    I do not know how to change it to 10.

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