class ExecutionDomain
Defined at line 41 of file ../../src/media/audio/audio_core/threading_model.h
Public Methods
void ExecutionDomain (async_dispatcher_t * dispatcher, fpromise::executor * executor, const std::string & name)
Defined at line 43 of file ../../src/media/audio/audio_core/threading_model.h
async_dispatcher_t * dispatcher ()
The async_dispatcher_t* for the loop running this domain.
Defined at line 48 of file ../../src/media/audio/audio_core/threading_model.h
fpromise::executor * executor ()
The fpromise::executor for the loop running this domain. Useful for scheduling
fpromise::promises for this domain.
Defined at line 52 of file ../../src/media/audio/audio_core/threading_model.h
const std::string & name ()
The name of this domain.
Defined at line 55 of file ../../src/media/audio/audio_core/threading_model.h
const ThreadToken & token ()
The `ThreadToken` that can be used to use static analysis to assert certain data members
are only accessed on this thread.
Ex:
class Foo {
public:
void TouchData() {
async::PostTask(domain_->dispatcher(), [] {
OBTAIN_EXECUTION_DOMAIN_TOKEN(token, domain_);
// This is now allowed since we've obtained the capability guarding `data_`.
data_.Mutate();
});
// This would be a compile-time error as we have not acquired the capability guarding
// `data_`.
//
// data_.Touch();
}
private:
ExecutionDomain* domain_;
Data data_ __TA_GUARDED(domain_->token());
};
Defined at line 78 of file ../../src/media/audio/audio_core/threading_model.h
zx_status_t PostTask (fit::closure task)
Convenience access to post a task to this domains dispatcher.
Ex, we can write:
threading_model().FidlDomain().PostTask([] {...});
Instead of:
async::PostTask(threading_model().FidlDomain().dispatcher(), [] {...});
Defined at line 86 of file ../../src/media/audio/audio_core/threading_model.h
zx_status_t PostDelayedTask (fit::closure task, zx::duration delay)
Defined at line 89 of file ../../src/media/audio/audio_core/threading_model.h
zx_status_t PostTaskForTime (fit::closure task, zx::time deadline)
Defined at line 92 of file ../../src/media/audio/audio_core/threading_model.h
void ScheduleTask (fpromise::pending_task task)
Convenience access to schedule a task to this domains executor.
Ex, we can write:
threading_model().FidlDomain().ScheduleTask(...);
Instead of:
threading_model().FidlDomain().executor().schedule_task(...);
Defined at line 102 of file ../../src/media/audio/audio_core/threading_model.h