mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-27 00:30:26 +00:00
Attempt safe shutdown.
This commit is contained in:
parent
96189bde4b
commit
07ce0f0133
@ -62,10 +62,16 @@ template <typename Performer> class AsyncUpdater {
|
||||
condition_.notify_all();
|
||||
}
|
||||
|
||||
void stop() {
|
||||
if(performer_thread_.joinable()) {
|
||||
should_quit = true;
|
||||
update([] {});
|
||||
performer_thread_.join();
|
||||
}
|
||||
}
|
||||
|
||||
~AsyncUpdater() {
|
||||
should_quit = true;
|
||||
update([] {});
|
||||
performer_thread_.join();
|
||||
stop();
|
||||
}
|
||||
|
||||
// The object that will actually receive time advances.
|
||||
|
@ -677,7 +677,6 @@ struct ActivityObserver: public Activity::Observer {
|
||||
#pragma mark - Timer
|
||||
|
||||
- (void)audioQueueIsRunningDry:(nonnull CSAudioQueue *)audioQueue {
|
||||
// TODO: Make audio flushes overt, and do one here.
|
||||
updater.update([self] {
|
||||
updater.performer.machine->flush_output();
|
||||
});
|
||||
@ -692,6 +691,8 @@ struct ActivityObserver: public Activity::Observer {
|
||||
});
|
||||
});
|
||||
|
||||
// TODO: restory sync locking; see below.
|
||||
|
||||
// First order of business: grab a timestamp.
|
||||
/* const auto timeNow = Time::nanos_now();
|
||||
|
||||
@ -724,6 +725,10 @@ struct ActivityObserver: public Activity::Observer {
|
||||
#define TICKS 120
|
||||
|
||||
- (void)start {
|
||||
// _timer = [[CSHighPrecisionTimer alloc] initWithTask:^{
|
||||
// updater.update([] {});
|
||||
// } interval:uint64_t(1000000000) / uint64_t(TICKS)];
|
||||
|
||||
// updater.performer.machine = _machine->timed_machine();
|
||||
/* __block auto lastTime = Time::nanos_now();
|
||||
|
||||
@ -805,8 +810,9 @@ struct ActivityObserver: public Activity::Observer {
|
||||
#undef TICKS
|
||||
|
||||
- (void)stop {
|
||||
[_timer invalidate];
|
||||
_timer = nil;
|
||||
updater.stop();
|
||||
// [_timer invalidate];
|
||||
// _timer = nil;
|
||||
}
|
||||
|
||||
+ (BOOL)attemptInstallROM:(NSURL *)url {
|
||||
|
Loading…
x
Reference in New Issue
Block a user