diff options
author | Justin Clark-Casey (justincc) | 2014-08-13 22:38:27 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-08-13 22:38:27 +0100 |
commit | 21176a3a901dd2190a1847acf576b938c0885e23 (patch) | |
tree | de76b08895632480f439bc026127126523c8ca93 /OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs | |
parent | Add 'server' stats information to pCampbot, as used elsewhere in OpenSimulator (diff) | |
download | opensim-SC-21176a3a901dd2190a1847acf576b938c0885e23.zip opensim-SC-21176a3a901dd2190a1847acf576b938c0885e23.tar.gz opensim-SC-21176a3a901dd2190a1847acf576b938c0885e23.tar.bz2 opensim-SC-21176a3a901dd2190a1847acf576b938c0885e23.tar.xz |
Terminate 'nothing' behaviour (and potentially others) by signalling using an event rather than polling connection state every 100ms
This kind of polling is very expensive with many bots/polling threads and appears to be the primary cause of bot falloff from the client end at higher loads.
Where inbound packet threads can't run in time due to contention and simulator disconnect timeout occurs.
Diffstat (limited to 'OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs')
-rw-r--r-- | OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs index 9bc8512..c1ba36b 100644 --- a/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs +++ b/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs | |||
@@ -29,11 +29,12 @@ using OpenMetaverse; | |||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Linq; | 31 | using System.Linq; |
32 | using System.Threading; | ||
32 | using pCampBot.Interfaces; | 33 | using pCampBot.Interfaces; |
33 | 34 | ||
34 | namespace pCampBot | 35 | namespace pCampBot |
35 | { | 36 | { |
36 | public class AbstractBehaviour : IBehaviour | 37 | public abstract class AbstractBehaviour : IBehaviour |
37 | { | 38 | { |
38 | /// <summary> | 39 | /// <summary> |
39 | /// Abbreviated name of this behaviour. | 40 | /// Abbreviated name of this behaviour. |
@@ -44,13 +45,20 @@ namespace pCampBot | |||
44 | 45 | ||
45 | public Bot Bot { get; protected set; } | 46 | public Bot Bot { get; protected set; } |
46 | 47 | ||
47 | public virtual void Action() {} | 48 | public abstract void Action(); |
49 | |||
50 | public virtual void Interrupt() {} | ||
51 | |||
52 | protected AutoResetEvent m_interruptEvent = new AutoResetEvent(false); | ||
48 | 53 | ||
49 | public virtual void Initialize(Bot bot) | 54 | public virtual void Initialize(Bot bot) |
50 | { | 55 | { |
51 | Bot = bot; | 56 | Bot = bot; |
52 | } | 57 | } |
53 | 58 | ||
54 | public virtual void Close() {} | 59 | public virtual void Close() |
60 | { | ||
61 | Interrupt(); | ||
62 | } | ||
55 | } | 63 | } |
56 | } | 64 | } |