Changeset af967ef9 in mainline
- Timestamp:
- 2023-10-10T17:37:09Z (15 months ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f9ae472
- Parents:
- bd2fab5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/gfxdemo/gfxdemo.c
rbd2fab5 raf967ef9 69 69 70 70 static bool quit = false; 71 static FIBRIL_MUTEX_INITIALIZE(quit_lock); 72 static FIBRIL_CONDVAR_INITIALIZE(quit_cv); 71 73 static gfx_typeface_t *tface; 72 74 static gfx_font_t *font; … … 83 85 // XXX Need a proper way to determine text mode 84 86 return w <= 80; 87 } 88 89 /** Sleep until timeout or quit request. 90 * 91 * @param msec Number of microseconds to sleep for 92 */ 93 static void demo_msleep(unsigned msec) 94 { 95 fibril_mutex_lock(&quit_lock); 96 97 if (!quit) { 98 (void) fibril_condvar_wait_timeout(&quit_cv, &quit_lock, 99 (usec_t)msec * 1000); 100 } 101 102 fibril_mutex_unlock(&quit_lock); 85 103 } 86 104 … … 316 334 gfx_color_delete(color); 317 335 318 fibril_usleep(500 * 1000); 319 336 demo_msleep(500); 320 337 if (quit) 321 338 break; … … 478 495 if (rc != EOK) 479 496 goto error; 480 fibril_usleep(250 * 1000); 481 497 498 demo_msleep(250); 482 499 if (quit) 483 500 goto out; … … 539 556 } 540 557 541 fibril_usleep(500 * 1000); 542 558 demo_msleep(500); 543 559 if (quit) 544 560 break; … … 600 616 } 601 617 602 fibril_usleep(500 * 1000); 603 618 demo_msleep(500); 604 619 if (quit) 605 620 break; … … 791 806 792 807 for (i = 0; i < 10; i++) { 793 fibril_usleep(500 * 1000);808 demo_msleep(500); 794 809 if (quit) 795 810 break; … … 872 887 873 888 for (i = 0; i < 10; i++) { 874 fibril_usleep(500 * 1000);889 demo_msleep(500); 875 890 if (quit) 876 891 break; … … 969 984 } 970 985 971 fibril_usleep(500 * 1000); 972 986 demo_msleep(500); 973 987 if (quit) 974 988 break; … … 1178 1192 } 1179 1193 1194 static void demo_quit(void) 1195 { 1196 fibril_mutex_lock(&quit_lock); 1197 quit = true; 1198 fibril_mutex_unlock(&quit_lock); 1199 fibril_condvar_broadcast(&quit_cv); 1200 } 1201 1180 1202 static void wnd_close_event(void *arg) 1181 1203 { 1182 quit = true;1204 demo_quit(); 1183 1205 } 1184 1206 … … 1186 1208 { 1187 1209 if (event->type == KEY_PRESS) 1188 quit = true;1210 demo_quit(); 1189 1211 } 1190 1212 1191 1213 static void uiwnd_close_event(ui_window_t *window, void *arg) 1192 1214 { 1193 quit = true;1215 demo_quit(); 1194 1216 } 1195 1217 … … 1197 1219 { 1198 1220 if (event->type == KEY_PRESS) 1199 quit = true;1221 demo_quit(); 1200 1222 } 1201 1223
Note:
See TracChangeset
for help on using the changeset viewer.