Always wait for mailbox.
This commit is contained in:
parent
64406035a7
commit
3b6874818a
@ -13601,8 +13601,6 @@ void MessagesManager::init() {
|
||||
td_->notification_settings_manager_->init(); // load scope notification settings
|
||||
init_stickers_manager(td_); // load available reactions
|
||||
|
||||
always_wait_for_mailbox();
|
||||
|
||||
start_time_ = Time::now();
|
||||
last_channel_pts_jump_warning_time_ = start_time_ - 3600;
|
||||
|
||||
|
@ -3114,8 +3114,6 @@ void Td::on_connection_state_changed(ConnectionState new_state) {
|
||||
}
|
||||
|
||||
void Td::start_up() {
|
||||
always_wait_for_mailbox();
|
||||
|
||||
uint64 check_endianness = 0x0706050403020100;
|
||||
auto check_endianness_raw = reinterpret_cast<const unsigned char *>(&check_endianness);
|
||||
for (unsigned char c = 0; c < 8; c++) {
|
||||
|
@ -79,8 +79,6 @@ class Actor : public ObserverBase {
|
||||
std::shared_ptr<ActorContext> set_context(std::shared_ptr<ActorContext> context);
|
||||
string set_tag(string tag);
|
||||
|
||||
void always_wait_for_mailbox();
|
||||
|
||||
// for ActorInfo mostly
|
||||
void init(ObjectPool<ActorInfo>::OwnerPtr &&info);
|
||||
ActorInfo *get_info();
|
||||
|
@ -164,8 +164,4 @@ inline Slice Actor::get_name() const {
|
||||
return info_->get_name();
|
||||
}
|
||||
|
||||
inline void Actor::always_wait_for_mailbox() {
|
||||
info_->always_wait_for_mailbox();
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -110,14 +110,12 @@ class ActorInfo final
|
||||
|
||||
void set_wait_generation(uint32 wait_generation);
|
||||
bool must_wait(uint32 wait_generation) const;
|
||||
void always_wait_for_mailbox();
|
||||
|
||||
private:
|
||||
Deleter deleter_ = Deleter::None;
|
||||
bool need_context_ = true;
|
||||
bool need_start_up_ = true;
|
||||
bool is_running_ = false;
|
||||
bool always_wait_for_mailbox_{false};
|
||||
uint32 wait_generation_{0};
|
||||
|
||||
std::atomic<int32> sched_id_{0};
|
||||
|
@ -66,11 +66,7 @@ inline void ActorInfo::set_wait_generation(uint32 wait_generation) {
|
||||
}
|
||||
|
||||
inline bool ActorInfo::must_wait(uint32 wait_generation) const {
|
||||
return wait_generation_ == wait_generation || (always_wait_for_mailbox_ && !mailbox_.empty());
|
||||
}
|
||||
|
||||
inline void ActorInfo::always_wait_for_mailbox() {
|
||||
always_wait_for_mailbox_ = true;
|
||||
return wait_generation_ == wait_generation || !mailbox_.empty();
|
||||
}
|
||||
|
||||
inline void ActorInfo::on_actor_moved(Actor *actor_new_ptr) {
|
||||
|
@ -571,7 +571,6 @@ TEST(Actors, stop_in_teardown) {
|
||||
class AlwaysWaitForMailbox final : public td::Actor {
|
||||
public:
|
||||
void start_up() final {
|
||||
always_wait_for_mailbox();
|
||||
td::create_actor<td::SleepActor>("Sleep", 0.1,
|
||||
td::PromiseCreator::lambda([actor_id = actor_id(this), ptr = this](td::Unit) {
|
||||
td::send_closure(actor_id, &AlwaysWaitForMailbox::g);
|
||||
|
Loading…
Reference in New Issue
Block a user