PageRenderTime 352ms CodeModel.GetById 148ms app.highlight 2ms RepoModel.GetById 118ms app.codeStats 0ms

/indra/newview/llmainlooprepeater.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 65 lines | 19 code | 11 blank | 35 comment | 0 complexity | 2c08950a2d4b53f21ce694c95e1b2985 MD5 | raw file
 1/** 
 2 * @file llmainlooprepeater.h
 3 * @brief a service for repeating messages on the main loop.
 4 *
 5 * $LicenseInfo:firstyear=2010&license=viewerlgpl$
 6 * Second Life Viewer Source Code
 7 * Copyright (C) 2010, Linden Research, Inc.
 8 * 
 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation;
12 * version 2.1 of the License only.
13 * 
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * Lesser General Public License for more details.
18 * 
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 * 
23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
24 * $/LicenseInfo$
25 */
26
27#ifndef LL_LLMAINLOOPREPEATER_H
28#define LL_LLMAINLOOPREPEATER_H
29
30
31#include "llsd.h"
32#include "llthreadsafequeue.h"
33
34
35//
36// A service which creates the pump 'mainlooprepeater' to which any thread can
37// post a message that will be re-posted on the main loop.
38//
39// The posted message should contain two map elements: pump and payload.  The
40// pump value is a string naming the pump to which the message should be
41// re-posted.  The payload value is what will be posted to the designated pump.
42//
43class LLMainLoopRepeater:
44	public LLSingleton<LLMainLoopRepeater>
45{
46public:
47	LLMainLoopRepeater(void);
48	
49	// Start the repeater service.
50	void start(void);
51	
52	// Stop the repeater service.
53	void stop(void);
54	
55private:
56	LLTempBoundListener mMainLoopConnection;
57	LLTempBoundListener mRepeaterConnection;
58	LLThreadSafeQueue<LLSD> * mQueue;
59	
60	bool onMainLoop(LLSD const &);
61	bool onMessage(LLSD const & event);
62};
63
64
65#endif