ApplicationManagerAPI.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #ifndef ASSETPROCESSOR_APPLICATIONMANAGERAPI_H
  9. #define ASSETPROCESSOR_APPLICATIONMANAGERAPI_H
  10. #include <AzCore/EBus/EBus.h>
  11. #include <AzCore/std/parallel/mutex.h>
  12. #pragma once
  13. namespace AssetProcessor
  14. {
  15. //! This class contains notifications broadcast by the Application Manager (Which manages the lifecycle of the application).
  16. //! note, these events will be dispatched sequentially and safely from one specific thread (main UI thread), but may be
  17. //! talking to an object on a different "unsafe" thread and thus appropriate thread safety should be observed by the listener.
  18. class ApplicationManagerNotifications
  19. : public AZ::EBusTraits
  20. {
  21. public:
  22. //////////////////////////////////////////////////////////////////////////
  23. /// Public API:
  24. //! Invoked by the application when its time to shut down
  25. //! Jobs must quit as soon as they can, with 'failed' status.
  26. virtual void ApplicationShutdownRequested() = 0;
  27. //////////////////////////////////////////////////////////////////////////
  28. //////////////////////////////////////////////////////////////////////////
  29. /// Bus Configuration
  30. ApplicationManagerNotifications() = default;
  31. ~ApplicationManagerNotifications() = default;
  32. static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple; // any number of connected listeners
  33. static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single; // no addressing used.
  34. typedef AZStd::recursive_mutex MutexType; // protect bus addition and removal since listeners can disconnect
  35. using Bus = AZ::EBus<ApplicationManagerNotifications>;
  36. //////////////////////////////////////////////////////////////////////////
  37. };
  38. } // namespace AssetProcesor
  39. #endif // ASSETPROCESSOR_APPLICATIONMANAGERAPI_H