int main(void) { #else int main(int argc, char **argv) { #endif #ifdef __patmos__ // nothing special to initialize #else /* __patmos__ */ core_id = strtol(argv[1], NULL, 0); // initialize MPBs shm_init(); #endif /* __patmos__ */ if (core_id == 0) { master(); } else { slave(); } #ifdef __patmos__ // nothing to clean up #else /* __patmos__ */ shm_clean(); #endif /* __patmos__ */ return 0; }
void clean_shm(int quick) { int i, cnt = 0; /* * to avoid deadlock, etc, under quick=1 we just delete the shm * areas and leave the X stuff hanging. */ if (quick) { shm_delete(&scanline_shm); shm_delete(&fullscreen_shm); shm_delete(&snaprect_shm); } else { shm_clean(&scanline_shm, scanline); shm_clean(&fullscreen_shm, fullscreen); shm_clean(&snaprect_shm, snaprect); } /* * Here we have to clean up quite a few shm areas for all * the possible tile row runs (40 for 1280), not as robust * as one might like... sometimes need to run ipcrm(1). */ for(i=1; i<=ntiles_x; i++) { if (i > tile_shm_count) { break; } if (quick) { shm_delete(&tile_row_shm[i]); } else { shm_clean(&tile_row_shm[i], tile_row[i]); } cnt++; if (single_copytile_count && i >= single_copytile_count) { break; } } if (!quiet && cnt > 0) { rfbLog("deleted %d tile_row polling images.\n", cnt); } }