hi fellows In my factor excursions, I am now looking into using parallel-map and other such combinators. There are two use cases I haven't found in the library, one is to run a limited number of threads at a time. This is useful for a file downloader, for example, and also if I have a list of ten thousand jobs to perform. (and don't want to launch that many so my program won't oom (crash)) Another usecase is when I want exclusive access to a resource, it can be any resource. for example, sending mail thru smtp, if I have a few messages to send, I don't want multiple connections to one server. I started coding a solution for this, which involves a manager, and each job object has its resources predefined on creation, and an action quotation, so the manager adds and removes the resources, and doesn't let jobs that have the same resources run. but it's too "all over the place", using global symbols and such, and I feel there is a better solution using futures and concurrency, instead of in-thread, but I don't know this material well.
How would you go about on this? I also saw counting semaphores for the first use case, but I'm guessing critical sections should be short locks and not network connections. maybe someone could introduce me to what I'm missing? Many thanks, Kobi PS: right now, factor is my favorite programming language, and I prefer to use it for solving issues and prototyping. :-) -- China: stop persecuting Falun Gong! http://faluninfo.net URGENT: Innocent people are being persecuted for their belief inside Communist China. ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk