Changeset e49b7997 in mainline


Ignore:
Timestamp:
2020-05-07T17:36:41Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c11ee605
Parents:
ef30659
Message:

Avoid race between closing display and getting events

Location:
uspace
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/gfxdemo/gfxdemo.c

    ref30659 re49b7997  
    499499                return rc;
    500500
     501        display_window_destroy(window);
     502        display_close(display);
     503
    501504        return EOK;
    502505}
  • uspace/lib/display/src/display.c

    ref30659 re49b7997  
    123123void display_close(display_t *display)
    124124{
     125        fibril_mutex_lock(&display->lock);
    125126        async_hangup(display->sess);
     127        display->sess = NULL;
    126128
    127129        /* Wait for callback handler to terminate */
    128130
    129         fibril_mutex_lock(&display->lock);
    130131        while (!display->cb_done)
    131132                fibril_condvar_wait(&display->cv, &display->lock);
     
    495496
    496497        while (true) {
    497                 rc = display_get_event(display, &window, &event);
     498                fibril_mutex_lock(&display->lock);
     499
     500                if (display->sess != NULL)
     501                        rc = display_get_event(display, &window, &event);
     502                else
     503                        rc = ENOENT;
     504
     505                fibril_mutex_unlock(&display->lock);
     506
    498507                if (rc != EOK)
    499508                        break;
Note: See TracChangeset for help on using the changeset viewer.