PageRenderTime 43ms CodeModel.GetById 20ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1
  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. #ifndef LL_LLMAINLOOPREPEATER_H
  27. #define LL_LLMAINLOOPREPEATER_H
  28. #include "llsd.h"
  29. #include "llthreadsafequeue.h"
  30. //
  31. // A service which creates the pump 'mainlooprepeater' to which any thread can
  32. // post a message that will be re-posted on the main loop.
  33. //
  34. // The posted message should contain two map elements: pump and payload. The
  35. // pump value is a string naming the pump to which the message should be
  36. // re-posted. The payload value is what will be posted to the designated pump.
  37. //
  38. class LLMainLoopRepeater:
  39. public LLSingleton<LLMainLoopRepeater>
  40. {
  41. public:
  42. LLMainLoopRepeater(void);
  43. // Start the repeater service.
  44. void start(void);
  45. // Stop the repeater service.
  46. void stop(void);
  47. private:
  48. LLTempBoundListener mMainLoopConnection;
  49. LLTempBoundListener mRepeaterConnection;
  50. LLThreadSafeQueue<LLSD> * mQueue;
  51. bool onMainLoop(LLSD const &);
  52. bool onMessage(LLSD const & event);
  53. };
  54. #endif