Mercurial > hg > orthanc-stone
annotate Framework/Deprecated/Toolbox/IDelayedCallExecutor.h @ 841:266e2b0b9abc
better error reporting in DicomStructureSetLoader + fixed POST request logic
in WebAssemblyOracle + support for LookupTableTextureSceneLayer in OpenGL (NOT
using shaders!) (2 new files) + a few small non-functional changes
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 11 Jun 2019 15:41:21 +0200 |
parents | c35e98d22764 |
children | e146743f6cdc 1c7ae79c426d |
rev | line source |
---|---|
431
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
1 /** |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
2 * Stone of Orthanc |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
6 * |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Affero General Public License |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
11 * |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
15 * Affero General Public License for more details. |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
16 * |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Affero General Public License |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
19 **/ |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
20 |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
21 |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
22 #pragma once |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
23 |
732
c35e98d22764
move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
726
diff
changeset
|
24 #include "../../Messages/IObserver.h" |
c35e98d22764
move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
726
diff
changeset
|
25 #include "../../Messages/ICallable.h" |
431
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
26 |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
27 #include <Core/IDynamicObject.h> |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
28 #include <Core/Logging.h> |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
29 |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
30 #include <string> |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
31 #include <map> |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
32 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
643
diff
changeset
|
33 namespace Deprecated |
431
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
34 { |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
35 // The IDelayedCall executes a callback after a delay (equivalent to timeout() function in javascript). |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
36 class IDelayedCallExecutor : public boost::noncopyable |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
37 { |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
38 protected: |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
643
diff
changeset
|
39 OrthancStone::MessageBroker& broker_; |
431
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
40 |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
41 public: |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
431
diff
changeset
|
42 ORTHANC_STONE_DEFINE_EMPTY_MESSAGE(__FILE__, __LINE__, TimeoutMessage); |
431
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
43 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
643
diff
changeset
|
44 IDelayedCallExecutor(OrthancStone::MessageBroker& broker) : |
431
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
45 broker_(broker) |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
46 { |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
47 } |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
48 |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
49 |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
50 virtual ~IDelayedCallExecutor() |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
51 { |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
52 } |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
53 |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
54 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
643
diff
changeset
|
55 virtual void Schedule(OrthancStone::MessageHandler<IDelayedCallExecutor::TimeoutMessage>* callback, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
643
diff
changeset
|
56 unsigned int timeoutInMs = 1000) = 0; |
431
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
57 }; |
26b90b110719
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
am@osimis.io
parents:
diff
changeset
|
58 } |