1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-25 16:31:42 +00:00

This then is what the serial dispatch queue and the triple buffer achieve together: I can post the runs over to the main thread for processing while emulation continues separately.

This commit is contained in:
Thomas Harte 2015-07-23 20:16:48 -04:00
parent e7237c7bd5
commit 0611646181

View File

@ -26,6 +26,9 @@ struct Atari2600CRTDelegate: public Outputs::CRT::CRTDelegate {
}
- (void)crtDidEndFrame:(Outputs::CRTFrame *)frame {
dispatch_async(dispatch_get_main_queue(), ^{
printf("\n\n===\n\n");
int c = 0;
for(int run = 0; run < frame->number_of_runs; run++)
@ -55,7 +58,11 @@ struct Atari2600CRTDelegate: public Outputs::CRT::CRTDelegate {
}
printf("\n\n[%d]\n\n", c);
dispatch_async(_serialDispatchQueue, ^{
_atari2600.get_crt()->return_frame();
});
});
}
- (void)runForNumberOfCycles:(int)cycles {
@ -76,7 +83,7 @@ struct Atari2600CRTDelegate: public Outputs::CRT::CRTDelegate {
if (self) {
_crtDelegate.atari = self;
_atari2600.get_crt()->set_delegate(&_crtDelegate);
_serialDispatchQueue = dispatch_queue_create("Atari 2600 quuue", DISPATCH_QUEUE_SERIAL);
_serialDispatchQueue = dispatch_queue_create("Atari 2600 queue", DISPATCH_QUEUE_SERIAL);
}
return self;