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++ MT-multithreading and servers » using gates but program lags
using gates but program lags [message #17682] Mon, 25 August 2008 22:01 Go to previous message
TeCNoYoTTa is currently offline  TeCNoYoTTa
Messages: 138
Registered: July 2008
Location: Egypt
Experienced Member

i call this function
String file_data = client.ExecuteRedirect(HttpClient::DEFAULT_MAX_REDIRECT, HttpClient::DEFAULT_RETRIES,THISBACK(progress_indecator));

and this is progress_indecator
bool Download_Manager_Window::progress_indecator(int x, int all)
{
	static float timer = 0;
	static float data = 0;
	static double counter = 0;
	double percentage;
	double temp1 = x, temp2 = all;
	if (all != 0)
		percentage = (temp1 / temp2) * 100.0;
	else
		percentage = 0;

	//label_DownloadDirectory.SetText(DblStr(percentage));

	progress_bar.Set(percentage, 100);

	timer = clock() - timer;

	data = x - data;

	//System("File path")
	//int percantage = (x/all)*100.0;

	if (data != 0 && timer != 0 && DblInt(counter) % 10 == 0)
	{
		//label_File.SetText(IntStr(x / 1000) + " KBs out of " + IntStr(all / 1000) + " KB ");
		int temp = data / timer;
		String temps = IntStr(temp);
		temps += " KB/S";
		label_DownloadSpeed.SetText(temps);
	}

	timer = clock();
	data = x;
	counter++;

	if (x == all && counter > 10)
	{
		timer = 0;
		data = 0;
		counter = 0;
		return true;
	}
	else
		return false;
}


but the program lags till the download finish

why ??
 
Read Message
Read Message
Previous Topic: calling back a function after finishing a thread
Next Topic: non-blocking socket.Write("test string") crash on linux [BUG?]
Goto Forum:
  


Current Time: Fri Apr 19 10:23:51 CEST 2024

Total time taken to generate the page: 0.02485 seconds