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 » Skylark - serving CSS style sheets
Re: Skylark - serving CSS style sheets [message #40302 is a reply to message #40301] Tue, 16 July 2013 09:29 Go to previous messageGo to previous message
Zbych is currently offline  Zbych
Messages: 327
Registered: July 2009
Senior Member
mdelfede wrote on Tue, 16 July 2013 09:06

This is my code to serve .css coming from .brc :

SKYLARK(Styles, "styles/*")
{
	static VectorMap<String, String> cssMap;
	static bool init = false;
	
	if(!init)
	{
		for(int i = 0; i < styles_count; i++)
			cssMap.Add(styles_files[i], String(styles[i], styles_length[i]));
		init = true;
	}
	
	int i = cssMap.Find(http[0]);
	if(i >= 0)
		http.Content("text/css", cssMap[i]);
}




Since Skylark is multi thread, your init section is risky. You should use ONCELOCK.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to pass vector/array of structs to witz?
Next Topic: File upload
Goto Forum:
  


Current Time: Fri Jun 07 16:28:01 CEST 2024

Total time taken to generate the page: 0.01678 seconds