Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » AsyncWork<Vector<T>> fails due to lack of copy-constructor
Re: AsyncWork<Vector<T>> fails due to lack of copy-constructor [message #52898 is a reply to message #52896] Tue, 07 January 2020 15:16 Go to previous message
mirek is currently offline  mirek
Messages: 14267
Registered: November 2005
Ultimate Member
OK, in trunk, AsyncWork is now able to get by here, but you need to call Pick instead of Get.

That said, still not 100% sure what is the goal, but if you wanted to process files in parallel, I have cooked up a little example for you for future reference:

#include <Core/Core.h>

using namespace Upp;

CONSOLE_APP_MAIN
{
	FindFile ff("c:/xxx/csv/*.csv");
	Mutex lock;
	int total_lines = 0;
	CoDo([&] {
		int lines = 0;
		for(;;) {
			String path;
			{
				Mutex::Lock __(lock);
				while(ff && !ff.IsFile())
					ff.Next();
				if(!ff) {
					total_lines += lines;
					return;
				}
				path = ff.GetPath();
				ff.Next();
				Cout() << "About to process " << path << "\n";
			}
			FileIn in(path);
			while(!in.IsEof()) {
				in.GetLine();
				lines++;
			}
		}
	});
	
	Cout() << "Total number of lines is " << total_lines << "\n";
}
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Bugfix AsGate64() works correctly on totals > 2^31
Next Topic: Problem linking using RegExp
Goto Forum:
  


Current Time: Fri Aug 22 09:16:23 CEST 2025

Total time taken to generate the page: 0.06026 seconds