← Back to articles

Introduction of a new class

Some LL commands, like llSetTimerEvent and llHTTPRequest, don't return immediately — they come back later as events. LSLLongCmdHandler is a new class with a dedicated thread that keeps track of these long-running requests.

Tedd

Some LL-commands takes longer to return. These often return with a event. For example llSetTimerEvent(10) will return a timer() event every 10 seconds. llHttpRequest() will return when it receives answer from HTTP-server.

To handle these types of requests a new class has been added as a subclass of ScriptEngine. The class is named LSLLongCmdHandler.cs. This class will contain handlers for adding/removing requests. Adding when script executes a command, removing when command is not complete yet but script is being moved to another region or otherwise removed.

The class has a dedicated thread that will be working the different services, for example async HTTP requests and queueing of timer events at the correct intervals. LSL_BuiltIn_Commands.cs accesses this class through ScriptEngine.

Example from LSL_BuiltIn_Commands.cs :

public void llSetTimerEvent(double sec)
{
 // Setting timer repeat
 m_ScriptEngine.myLSLLongCmdHandler.SetTimerEvent(m_localID, m_itemID, sec);
} 

Written by Tedd · Oslo, Norway

Updated 5 Jan 2017

Follow the journal via RSS