aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llplugin/llpluginprocessparent.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llplugin/llpluginprocessparent.h')
-rwxr-xr-xlinden/indra/llplugin/llpluginprocessparent.h32
1 files changed, 30 insertions, 2 deletions
diff --git a/linden/indra/llplugin/llpluginprocessparent.h b/linden/indra/llplugin/llpluginprocessparent.h
index 523ce51..a8929b1 100755
--- a/linden/indra/llplugin/llpluginprocessparent.h
+++ b/linden/indra/llplugin/llpluginprocessparent.h
@@ -36,6 +36,8 @@
36#ifndef LL_LLPLUGINPROCESSPARENT_H 36#ifndef LL_LLPLUGINPROCESSPARENT_H
37#define LL_LLPLUGINPROCESSPARENT_H 37#define LL_LLPLUGINPROCESSPARENT_H
38 38
39#include <queue> //imprudence
40
39#include "llapr.h" 41#include "llapr.h"
40#include "llprocesslauncher.h" 42#include "llprocesslauncher.h"
41#include "llpluginmessage.h" 43#include "llpluginmessage.h"
@@ -43,12 +45,14 @@
43#include "llpluginsharedmemory.h" 45#include "llpluginsharedmemory.h"
44 46
45#include "lliosocket.h" 47#include "lliosocket.h"
48#include "llthread.h"
46 49
47class LLPluginProcessParentOwner 50class LLPluginProcessParentOwner
48{ 51{
49public: 52public:
50 virtual ~LLPluginProcessParentOwner(); 53 virtual ~LLPluginProcessParentOwner();
51 virtual void receivePluginMessage(const LLPluginMessage &message) = 0; 54 virtual void receivePluginMessage(const LLPluginMessage &message) = 0;
55 virtual bool receivePluginMessageEarly(const LLPluginMessage &message) {return false;};
52 // This will only be called when the plugin has died unexpectedly 56 // This will only be called when the plugin has died unexpectedly
53 virtual void pluginLaunchFailed() {}; 57 virtual void pluginLaunchFailed() {};
54 virtual void pluginDied() {}; 58 virtual void pluginDied() {};
@@ -76,6 +80,9 @@ public:
76 // returns true if the process has exited or we've had a fatal error 80 // returns true if the process has exited or we've had a fatal error
77 bool isDone(void); 81 bool isDone(void);
78 82
83 // returns true if the process is currently waiting on a blocking request
84 bool isBlocked(void) { return mBlocked; };
85
79 void killSockets(void); 86 void killSockets(void);
80 87
81 // Go to the proper error state 88 // Go to the proper error state
@@ -89,7 +96,9 @@ public:
89 void receiveMessage(const LLPluginMessage &message); 96 void receiveMessage(const LLPluginMessage &message);
90 97
91 // Inherited from LLPluginMessagePipeOwner 98 // Inherited from LLPluginMessagePipeOwner
92 void receiveMessageRaw(const std::string &message); 99 /*virtual*/ void receiveMessageRaw(const std::string &message);
100 /*virtual*/ void receiveMessageEarly(const LLPluginMessage &message);
101 /*virtual*/ void setMessagePipe(LLPluginMessagePipe *message_pipe) ;
93 102
94 // This adds a memory segment shared with the client, generating a name for the segment. The name generated is guaranteed to be unique on the host. 103 // This adds a memory segment shared with the client, generating a name for the segment. The name generated is guaranteed to be unique on the host.
95 // The caller must call removeSharedMemory first (and wait until getSharedMemorySize returns 0 for the indicated name) before re-adding a segment with the same name. 104 // The caller must call removeSharedMemory first (and wait until getSharedMemorySize returns 0 for the indicated name) before re-adding a segment with the same name.
@@ -112,7 +121,11 @@ public:
112 void setLockupTimeout(F32 timeout) { mPluginLockupTimeout = timeout; }; 121 void setLockupTimeout(F32 timeout) { mPluginLockupTimeout = timeout; };
113 122
114 F64 getCPUUsage() { return mCPUUsage; }; 123 F64 getCPUUsage() { return mCPUUsage; };
115 124
125 static void poll(F64 timeout);
126 static bool canPollThreadRun() { return (sPollSet || sPollsetNeedsRebuild || sUseReadThread); };
127 static void setUseReadThread(bool use_read_thread);
128 static bool getUseReadThread() { return sUseReadThread; };
116private: 129private:
117 130
118 enum EState 131 enum EState
@@ -162,12 +175,27 @@ private:
162 175
163 bool mDisableTimeout; 176 bool mDisableTimeout;
164 bool mDebug; 177 bool mDebug;
178 bool mBlocked;
179 bool mPolledInput;
165 180
166 LLProcessLauncher mDebugger; 181 LLProcessLauncher mDebugger;
167 182
168 F32 mPluginLaunchTimeout; // Somewhat longer timeout for initial launch. 183 F32 mPluginLaunchTimeout; // Somewhat longer timeout for initial launch.
169 F32 mPluginLockupTimeout; // If we don't receive a heartbeat in this many seconds, we declare the plugin locked up. 184 F32 mPluginLockupTimeout; // If we don't receive a heartbeat in this many seconds, we declare the plugin locked up.
170 185
186 static bool sUseReadThread;
187 apr_pollfd_t mPollFD;
188 static apr_pollset_t *sPollSet;
189 static bool sPollsetNeedsRebuild;
190 static LLMutex *sInstancesMutex;
191 static std::list<LLPluginProcessParent*> sInstances;
192 static void dirtyPollSet();
193 static void updatePollset();
194 void servicePoll();
195 static LLThread *sReadThread;
196
197 LLMutex mIncomingQueueMutex;
198 std::queue<LLPluginMessage> mIncomingQueue;
171}; 199};
172 200
173#endif // LL_LLPLUGINPROCESSPARENT_H 201#endif // LL_LLPLUGINPROCESSPARENT_H