init TdDb in db thread
This commit is contained in:
parent
f95f76c4de
commit
2171452e77
@ -389,6 +389,17 @@ Status TdDb::init_sqlite(int32 scheduler_id, const TdParameters ¶meters, con
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TdDb::open(int32 scheduler_id, TdParameters parameters, DbKey key, Promise<OpenedDatabase> &&promise) {
|
void TdDb::open(int32 scheduler_id, TdParameters parameters, DbKey key, Promise<OpenedDatabase> &&promise) {
|
||||||
|
if (scheduler_id >= 0 && Scheduler::instance()->sched_id() != scheduler_id) {
|
||||||
|
class Worker final : public Actor {
|
||||||
|
public:
|
||||||
|
void open(TdParameters &¶meters, DbKey &&key, Promise<OpenedDatabase> &&promise) {
|
||||||
|
TdDb::open(-1, std::move(parameters), std::move(key), std::move(promise));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
send_closure(create_actor_on_scheduler<Worker>("worker", scheduler_id), &Worker::open, std::move(parameters),
|
||||||
|
std::move(key), std::move(promise));
|
||||||
|
return;
|
||||||
|
}
|
||||||
OpenedDatabase result;
|
OpenedDatabase result;
|
||||||
|
|
||||||
// Init pmc
|
// Init pmc
|
||||||
|
Loading…
x
Reference in New Issue
Block a user