Ignore:
Timestamp:
2009-08-21T07:25:50Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
207e208e
Parents:
057d21a
Message:

Fibril synchronization needs to have a means to interrupt
idle threads from waiting for IPC and get them to execute
awakened fibrils.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/generic/fibril_sync.c

    r057d21a r8619f25  
    4040#include <assert.h>
    4141
     42static void optimize_execution_power(void)
     43{
     44        /*
     45         * When waking up a worker fibril previously blocked in fibril
     46         * synchronization, chances are that there is an idle manager fibril
     47         * waiting for IPC, that could start executing the awakened worker
     48         * fibril right away. We try to detect this and bring the manager
     49         * fibril back to fruitful work.
     50         */
     51        if (atomic_get(&threads_in_ipc_wait) > 0)
     52                ipc_poke();
     53}
     54
    4255void fibril_mutex_initialize(fibril_mutex_t *fm)
    4356{
     
    8497                list_remove(&f->link);
    8598                fibril_add_ready((fid_t) f);
     99                optimize_execution_power();
    86100        }
    87101}
     
    152166                        fibril_add_ready((fid_t) f);
    153167                        frw->writers++;
     168                        optimize_execution_power();
    154169                        break;
    155170                } else {
     
    157172                        fibril_add_ready((fid_t) f);
    158173                        frw->readers++;
     174                        optimize_execution_power();
    159175                }
    160176        }
     
    200216                list_remove(&f->link);
    201217                fibril_add_ready((fid_t) f);
     218                optimize_execution_power();
    202219                if (once)
    203220                        break;
Note: See TracChangeset for help on using the changeset viewer.