U++ framework
Do not panic. Ask here before giving up.

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: 332
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: Mon Sep 28 15:51:49 GMT+2 2026

Total time taken to generate the page: 0.25120 seconds