diff options
author | UbitUmarov | 2018-02-03 08:08:59 +0000 |
---|---|---|
committer | UbitUmarov | 2018-02-03 08:08:59 +0000 |
commit | 04a8ec518d5d7d8b69b62cd31c192c60d953b6df (patch) | |
tree | 62f0d7556770ac8fb357d7345946f260bd09049c /OpenSim/Region/ScriptEngine/XMREngine/XMRInstBackend.cs | |
parent | update opensim.ini.example with XMRengine information (diff) | |
download | opensim-SC-04a8ec518d5d7d8b69b62cd31c192c60d953b6df.zip opensim-SC-04a8ec518d5d7d8b69b62cd31c192c60d953b6df.tar.gz opensim-SC-04a8ec518d5d7d8b69b62cd31c192c60d953b6df.tar.bz2 opensim-SC-04a8ec518d5d7d8b69b62cd31c192c60d953b6df.tar.xz |
XMR: there is no need for a slice thread, it also causes timing issues; BelowNormal mb 2 Below on win; cosmetics
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XMREngine/XMRInstBackend.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/XMREngine/XMRInstBackend.cs | 86 |
1 files changed, 50 insertions, 36 deletions
diff --git a/OpenSim/Region/ScriptEngine/XMREngine/XMRInstBackend.cs b/OpenSim/Region/ScriptEngine/XMREngine/XMRInstBackend.cs index acf1e66..edbd5ce 100644 --- a/OpenSim/Region/ScriptEngine/XMREngine/XMRInstBackend.cs +++ b/OpenSim/Region/ScriptEngine/XMREngine/XMRInstBackend.cs | |||
@@ -27,17 +27,9 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Threading; | 29 | using System.Threading; |
30 | using System.Reflection; | ||
31 | using System.Collections; | ||
32 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
33 | using System.Runtime.Remoting.Lifetime; | ||
34 | using System.Security.Policy; | ||
35 | using System.IO; | ||
36 | using System.Xml; | ||
37 | using System.Text; | ||
38 | using OpenMetaverse; | 31 | using OpenMetaverse; |
39 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
40 | using OpenSim.Region.ScriptEngine.Interfaces; | ||
41 | using OpenSim.Region.ScriptEngine.Shared; | 33 | using OpenSim.Region.ScriptEngine.Shared; |
42 | using OpenSim.Region.ScriptEngine.Shared.Api; | 34 | using OpenSim.Region.ScriptEngine.Shared.Api; |
43 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 35 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
@@ -331,7 +323,8 @@ namespace OpenSim.Region.ScriptEngine.XMREngine | |||
331 | ScriptEventCode evc = ScriptEventCode.None; | 323 | ScriptEventCode evc = ScriptEventCode.None; |
332 | 324 | ||
333 | callNo = -1; | 325 | callNo = -1; |
334 | try { | 326 | try |
327 | { | ||
335 | if (callMode == CallMode_NORMAL) goto findevent; | 328 | if (callMode == CallMode_NORMAL) goto findevent; |
336 | 329 | ||
337 | /* | 330 | /* |
@@ -344,9 +337,11 @@ namespace OpenSim.Region.ScriptEngine.XMREngine | |||
344 | returnMask2 = (int)sv[2]; | 337 | returnMask2 = (int)sv[2]; |
345 | mask1 = (int)sv[3]; | 338 | mask1 = (int)sv[3]; |
346 | mask2 = (int)sv[4]; | 339 | mask2 = (int)sv[4]; |
347 | switch (callNo) { | 340 | switch (callNo) |
341 | { | ||
348 | case 0: goto __call0; | 342 | case 0: goto __call0; |
349 | case 1: { | 343 | case 1: |
344 | { | ||
350 | evc1 = (int)sv[5]; | 345 | evc1 = (int)sv[5]; |
351 | evc = (ScriptEventCode)(int)sv[6]; | 346 | evc = (ScriptEventCode)(int)sv[6]; |
352 | DetectParams[] detprms = ObjArrToDetPrms ((object[])sv[7]); | 347 | DetectParams[] detprms = ObjArrToDetPrms ((object[])sv[7]); |
@@ -362,13 +357,15 @@ namespace OpenSim.Region.ScriptEngine.XMREngine | |||
362 | */ | 357 | */ |
363 | findevent: | 358 | findevent: |
364 | Monitor.Enter (m_QueueLock); | 359 | Monitor.Enter (m_QueueLock); |
365 | for (lln = m_EventQueue.First; lln != null; lln = lln.Next) { | 360 | for (lln = m_EventQueue.First; lln != null; lln = lln.Next) |
361 | { | ||
366 | evt = lln.Value; | 362 | evt = lln.Value; |
367 | evc = (ScriptEventCode)Enum.Parse (typeof (ScriptEventCode), evt.EventName); | 363 | evc = (ScriptEventCode)Enum.Parse (typeof (ScriptEventCode), evt.EventName); |
368 | evc1 = (int)evc; | 364 | evc1 = (int)evc; |
369 | evc2 = evc1 - 32; | 365 | evc2 = evc1 - 32; |
370 | if ((((uint)evc1 < (uint)32) && (((mask1 >> evc1) & 1) != 0)) || | 366 | if ((((uint)evc1 < (uint)32) && (((mask1 >> evc1) & 1) != 0)) || |
371 | (((uint)evc2 < (uint)32) && (((mask2 >> evc2) & 1) != 0))) goto remfromq; | 367 | (((uint)evc2 < (uint)32) && (((mask2 >> evc2) & 1) != 0))) |
368 | goto remfromq; | ||
372 | } | 369 | } |
373 | 370 | ||
374 | /* | 371 | /* |
@@ -389,9 +386,9 @@ namespace OpenSim.Region.ScriptEngine.XMREngine | |||
389 | */ | 386 | */ |
390 | remfromq: | 387 | remfromq: |
391 | m_EventQueue.Remove (lln); | 388 | m_EventQueue.Remove (lln); |
392 | if ((uint)evc1 < (uint)m_EventCounts.Length) { | 389 | if ((uint)evc1 < (uint)m_EventCounts.Length) |
393 | m_EventCounts[evc1] --; | 390 | m_EventCounts[evc1] --; |
394 | } | 391 | |
395 | Monitor.Exit (m_QueueLock); | 392 | Monitor.Exit (m_QueueLock); |
396 | m_InstEHEvent ++; | 393 | m_InstEHEvent ++; |
397 | 394 | ||
@@ -399,7 +396,8 @@ namespace OpenSim.Region.ScriptEngine.XMREngine | |||
399 | * See if returnable or background event. | 396 | * See if returnable or background event. |
400 | */ | 397 | */ |
401 | if ((((uint)evc1 < (uint)32) && (((returnMask1 >> evc1) & 1) != 0)) || | 398 | if ((((uint)evc1 < (uint)32) && (((returnMask1 >> evc1) & 1) != 0)) || |
402 | (((uint)evc2 < (uint)32) && (((returnMask2 >> evc2) & 1) != 0))) { | 399 | (((uint)evc2 < (uint)32) && (((returnMask2 >> evc2) & 1) != 0))) |
400 | { | ||
403 | 401 | ||
404 | /* | 402 | /* |
405 | * Returnable event, return its parameters in a list. | 403 | * Returnable event, return its parameters in a list. |
@@ -408,11 +406,15 @@ namespace OpenSim.Region.ScriptEngine.XMREngine | |||
408 | int plen = evt.Params.Length; | 406 | int plen = evt.Params.Length; |
409 | object[] plist = new object[plen+1]; | 407 | object[] plist = new object[plen+1]; |
410 | plist[0] = (LSL_Integer)evc1; | 408 | plist[0] = (LSL_Integer)evc1; |
411 | for (int i = 0; i < plen;) { | 409 | for (int i = 0; i < plen;) |
410 | { | ||
412 | object ob = evt.Params[i]; | 411 | object ob = evt.Params[i]; |
413 | if (ob is int) ob = (LSL_Integer)(int)ob; | 412 | if (ob is int) |
414 | else if (ob is double) ob = (LSL_Float)(double)ob; | 413 | ob = (LSL_Integer)(int)ob; |
415 | else if (ob is string) ob = (LSL_String)(string)ob; | 414 | else if (ob is double) |
415 | ob = (LSL_Float)(double)ob; | ||
416 | else if (ob is string) | ||
417 | ob = (LSL_String)(string)ob; | ||
416 | plist[++i] = ob; | 418 | plist[++i] = ob; |
417 | } | 419 | } |
418 | m_DetectParams = evt.DetectParams; | 420 | m_DetectParams = evt.DetectParams; |
@@ -426,7 +428,8 @@ namespace OpenSim.Region.ScriptEngine.XMREngine | |||
426 | callNo = 1; | 428 | callNo = 1; |
427 | __call1: | 429 | __call1: |
428 | ScriptEventHandler seh = m_ObjCode.scriptEventHandlerTable[stateCode,evc1]; | 430 | ScriptEventHandler seh = m_ObjCode.scriptEventHandlerTable[stateCode,evc1]; |
429 | if (seh == null) goto checktmo; | 431 | if (seh == null) |
432 | goto checktmo; | ||
430 | 433 | ||
431 | DetectParams[] saveDetParams = this.m_DetectParams; | 434 | DetectParams[] saveDetParams = this.m_DetectParams; |
432 | object[] saveEHArgs = this.ehArgs; | 435 | object[] saveEHArgs = this.ehArgs; |
@@ -436,26 +439,33 @@ namespace OpenSim.Region.ScriptEngine.XMREngine | |||
436 | this.ehArgs = evt.Params; | 439 | this.ehArgs = evt.Params; |
437 | this.eventCode = evc; | 440 | this.eventCode = evc; |
438 | 441 | ||
439 | try { | 442 | try |
443 | { | ||
440 | seh (this); | 444 | seh (this); |
441 | } finally { | 445 | } |
442 | this.m_DetectParams = saveDetParams; | 446 | finally |
443 | this.ehArgs = saveEHArgs; | 447 | { |
444 | this.eventCode = saveEventCode; | 448 | m_DetectParams = saveDetParams; |
449 | ehArgs = saveEHArgs; | ||
450 | eventCode = saveEventCode; | ||
445 | } | 451 | } |
446 | 452 | ||
447 | /* | 453 | /* |
448 | * Keep waiting until we find a returnable event or timeout. | 454 | * Keep waiting until we find a returnable event or timeout. |
449 | */ | 455 | */ |
450 | checktmo: | 456 | checktmo: |
451 | if (DateTime.UtcNow < sleepUntil) goto findevent; | 457 | if (DateTime.UtcNow < sleepUntil) |
458 | goto findevent; | ||
452 | 459 | ||
453 | /* | 460 | /* |
454 | * We timed out, return an empty list. | 461 | * We timed out, return an empty list. |
455 | */ | 462 | */ |
456 | return emptyList; | 463 | return emptyList; |
457 | } finally { | 464 | } |
458 | if (callMode != CallMode_NORMAL) { | 465 | finally |
466 | { | ||
467 | if (callMode != CallMode_NORMAL) | ||
468 | { | ||
459 | 469 | ||
460 | /* | 470 | /* |
461 | * Stack frame is being saved by CheckRun...(). | 471 | * Stack frame is being saved by CheckRun...(). |
@@ -468,7 +478,8 @@ namespace OpenSim.Region.ScriptEngine.XMREngine | |||
468 | sv[2] = returnMask2; // needed at __call0,__call1 | 478 | sv[2] = returnMask2; // needed at __call0,__call1 |
469 | sv[3] = mask1; // needed at __call0,__call1 | 479 | sv[3] = mask1; // needed at __call0,__call1 |
470 | sv[4] = mask2; // needed at __call0,__call1 | 480 | sv[4] = mask2; // needed at __call0,__call1 |
471 | if (callNo == 1) { | 481 | if (callNo == 1) |
482 | { | ||
472 | sv[5] = evc1; // needed at __call1 | 483 | sv[5] = evc1; // needed at __call1 |
473 | sv[6] = (int)evc; // needed at __call1 | 484 | sv[6] = (int)evc; // needed at __call1 |
474 | sv[7] = DetPrmsToObjArr (evt.DetectParams); // needed at __call1 | 485 | sv[7] = DetPrmsToObjArr (evt.DetectParams); // needed at __call1 |
@@ -515,7 +526,8 @@ namespace OpenSim.Region.ScriptEngine.XMREngine | |||
515 | object[] obs = new object[len*16+1]; | 526 | object[] obs = new object[len*16+1]; |
516 | int j = 0; | 527 | int j = 0; |
517 | obs[j++] = (LSL_Integer)saveDPVer; | 528 | obs[j++] = (LSL_Integer)saveDPVer; |
518 | for (int i = 0; i < len; i ++) { | 529 | for (int i = 0; i < len; i ++) |
530 | { | ||
519 | DetectParams dp = dps[i]; | 531 | DetectParams dp = dps[i]; |
520 | obs[j++] = (LSL_String)dp.Key.ToString(); // UUID | 532 | obs[j++] = (LSL_String)dp.Key.ToString(); // UUID |
521 | obs[j++] = dp.OffsetPos; // vector | 533 | obs[j++] = dp.OffsetPos; // vector |
@@ -550,14 +562,14 @@ namespace OpenSim.Region.ScriptEngine.XMREngine | |||
550 | private static DetectParams[] ObjArrToDetPrms (object[] objs) | 562 | private static DetectParams[] ObjArrToDetPrms (object[] objs) |
551 | { | 563 | { |
552 | int j = 0; | 564 | int j = 0; |
553 | if ((objs.Length % 16 != 1) || (ListInt (objs[j++]) != saveDPVer)) { | 565 | if ((objs.Length % 16 != 1) || (ListInt (objs[j++]) != saveDPVer)) |
554 | throw new Exception ("invalid detect param format"); | 566 | throw new Exception ("invalid detect param format"); |
555 | } | ||
556 | 567 | ||
557 | int len = objs.Length / 16; | 568 | int len = objs.Length / 16; |
558 | DetectParams[] dps = new DetectParams[len]; | 569 | DetectParams[] dps = new DetectParams[len]; |
559 | 570 | ||
560 | for (int i = 0; i < len; i ++) { | 571 | for (int i = 0; i < len; i ++) |
572 | { | ||
561 | DetectParams dp = new DetectParams (); | 573 | DetectParams dp = new DetectParams (); |
562 | 574 | ||
563 | dp.Key = new UUID (ListStr (objs[j++])); | 575 | dp.Key = new UUID (ListStr (objs[j++])); |
@@ -612,9 +624,11 @@ namespace OpenSim.Region.ScriptEngine.XMREngine | |||
612 | /* | 624 | /* |
613 | * Clear out any old events from the queue. | 625 | * Clear out any old events from the queue. |
614 | */ | 626 | */ |
615 | lock (m_QueueLock) { | 627 | lock (m_QueueLock) |
628 | { | ||
616 | m_EventQueue.Clear(); | 629 | m_EventQueue.Clear(); |
617 | for (int i = m_EventCounts.Length; -- i >= 0;) m_EventCounts[i] = 0; | 630 | for (int i = m_EventCounts.Length; -- i >= 0;) |
631 | m_EventCounts[i] = 0; | ||
618 | } | 632 | } |
619 | } | 633 | } |
620 | 634 | ||