Changeset bdd5a63 in buchla-emu for emu/main.c


Ignore:
Timestamp:
08/01/2017 10:32:52 PM (7 years ago)
Author:
Thomas Lopatic <thomas@…>
Branches:
master
Children:
6e313dd
Parents:
ea878ba
Message:

Separate thread for rendering.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • emu/main.c

    rea878ba rbdd5a63  
    4040const char *bios = "bios.abs";
    4141const char *disk = "buchla.disk";
     42
     43SDL_atomic_t run;
    4244
    4345static void usage(FILE *fh)
     
    118120}
    119121
     122static int32_t cpu_thread(void *data)
     123{
     124        (void)data;
     125
     126        cpu_loop();
     127        return 0;
     128}
     129
    120130int32_t main(int32_t argc, char *argv[])
    121131{
    122132        parse_args(argc, argv);
    123133        sdl_init();
     134        cpu_init();
    124135
    125         cpu_loop();
     136        SDL_AtomicSet(&run, 1);
     137        SDL_Thread *thr = SDL_CreateThread(cpu_thread, "cpu", NULL);
    126138
     139        if (thr == NULL) {
     140                fail("SDL_CreateThread() failed: %s", SDL_GetError());
     141        }
     142
     143        sdl_loop();
     144        SDL_WaitThread(thr, NULL);
     145
     146        cpu_quit();
    127147        sdl_quit();
    128148        return 0;
Note: See TracChangeset for help on using the changeset viewer.