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 { - (void)crtDidEndFrame:(Outputs::CRTFrame *)frame {
dispatch_async(dispatch_get_main_queue(), ^{
printf("\n\n===\n\n"); printf("\n\n===\n\n");
int c = 0; int c = 0;
for(int run = 0; run < frame->number_of_runs; run++) 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); printf("\n\n[%d]\n\n", c);
dispatch_async(_serialDispatchQueue, ^{
_atari2600.get_crt()->return_frame(); _atari2600.get_crt()->return_frame();
});
});
} }
- (void)runForNumberOfCycles:(int)cycles { - (void)runForNumberOfCycles:(int)cycles {
@ -76,7 +83,7 @@ struct Atari2600CRTDelegate: public Outputs::CRT::CRTDelegate {
if (self) { if (self) {
_crtDelegate.atari = self; _crtDelegate.atari = self;
_atari2600.get_crt()->set_delegate(&_crtDelegate); _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; return self;