Branch data Line data Source code
1 : : // Copyright 2026 HPActor Contributors
2 : : //
3 : : // Licensed under the Apache License, Version 2.0 (the "License");
4 : : // you may not use this file except in compliance with the License.
5 : : // You may obtain a copy of the License at
6 : : //
7 : : // http://www.apache.org/licenses/LICENSE-2.0
8 : : //
9 : : // Unless required by applicable law or agreed to in writing, software
10 : : // distributed under the License is distributed on an "AS IS" BASIS,
11 : : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : : // See the License for the specific language governing permissions and
13 : : // limitations under the License.
14 : :
15 : : #pragma once
16 : :
17 : : #include <hpactor/actor/event_based_actor.hpp>
18 : : #include <hpactor/sched/dispatch_policy.hpp>
19 : :
20 : : namespace hpactor {
21 : :
22 : : class DenseComputingActor : public EventBasedActor {
23 : : public:
24 : 3 : DenseComputingActor(ActorContext* ctx, ActorSystem& sys,
25 : : uint32_t pool_size = 1)
26 : 3 : : EventBasedActor(ctx, sys), pool_size_(pool_size) {}
27 : :
28 : 4 : sched::DispatchPolicy dispatch_policy() const override {
29 : 4 : return sched::DispatchPolicy::DedicatedPool;
30 : : }
31 : :
32 : 4 : sched::DispatchHints dispatch_hints() const override {
33 : 4 : sched::DispatchHints h;
34 : 4 : h.pool_size = pool_size_;
35 : 4 : return h;
36 : : }
37 : :
38 : : uint32_t pool_size() const { return pool_size_; }
39 : :
40 : : protected:
41 : : uint32_t pool_size_;
42 : : };
43 : :
44 : : } // namespace hpactor
|