Changeset cc27c8c5 in mainline


Ignore:
Timestamp:
2009-06-08T18:13:00Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bac82eeb
Parents:
d9c8c81
Message:

A little bit of cleanup and a remedy for great confusion introduced in revision 2483.

Location:
uspace/lib/libc/generic
Files:
2 edited

Legend:

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

    rd9c8c81 rcc27c8c5  
    551551        /* Answer all remaining messages with EHANGUP */
    552552        while (!list_empty(&FIBRIL_connection->msg_queue)) {
    553                 msg_t *msg
    554                     = list_get_instance(FIBRIL_connection->msg_queue.next, msg_t, link);
    555                
     553                msg_t *msg;
     554               
     555                msg = list_get_instance(FIBRIL_connection->msg_queue.next,
     556                    msg_t, link);
    556557                list_remove(&msg->link);
    557558                ipc_answer_0(msg->callid, EHANGUP);
     
    718719                suseconds_t timeout;
    719720                if (!list_empty(&timeout_list)) {
    720                         awaiter_t *waiter
    721                             = list_get_instance(timeout_list.next, awaiter_t, link);
     721                        awaiter_t *waiter = list_get_instance(timeout_list.next,
     722                            awaiter_t, link);
    722723                       
    723724                        struct timeval tv;
     
    736737               
    737738                ipc_call_t call;
    738                 ipc_callid_t callid
    739                     = ipc_wait_cycle(&call, timeout, SYNCH_FLAGS_NONE);
     739                ipc_callid_t callid = ipc_wait_cycle(&call, timeout,
     740                    SYNCH_FLAGS_NONE);
    740741               
    741742                if (!callid) {
  • uspace/lib/libc/generic/fibril.c

    rd9c8c81 rcc27c8c5  
    5050#endif
    5151
    52 /** This futex serializes access to ready_list, serialized_list and manage_list.
     52/**
     53 * This futex serializes access to ready_list, serialized_list and manager_list.
    5354 */
    5455static atomic_t fibril_futex = FUTEX_INITIALIZER;
     
    6061static void fibril_main(void);
    6162
    62 /** Number of fibrils that are in async_serialized mode */
    63 static int serialized_fibrils;  /* Protected by async_futex */
    64 /** Thread-local count of serialization. If >0, we must not preempt */
     63/** Number of threads that are executing a manager fibril. */
     64static int threads_in_manager;
     65/** Number of threads that are executing a manager fibril and are serialized. */
     66static int serialized_threads;  /* Protected by async_futex */
     67/** Thread-local count of serialization. If > 0, we must not preempt */
    6568static __thread int serialization_count;
    66 /** Counter for fibrils residing in async_manager */
    67 static int fibrils_in_manager;
    6869
    6970/** Setup fibril information into TCB structure */
     
    144145                        goto ret_0;
    145146                /*
    146                  * Do not preempt if there is not sufficient count of fibril
    147                  * managers.
     147                 * Do not preempt if there is not enough threads to run the
     148                 * ready fibrils, which are not serialized.
    148149                 */
    149150                if (list_empty(&serialized_list) &&
    150                     fibrils_in_manager <= serialized_fibrils) {
     151                    threads_in_manager <= serialized_threads) {
    151152                        goto ret_0;
    152153                }
     
    195196                else if (stype == FIBRIL_FROM_MANAGER) {
    196197                        list_append(&srcf->link, &manager_list);
    197                         fibrils_in_manager--;
     198                        threads_in_manager--;
    198199                } else {       
    199200                        /*
     
    209210                dstf = list_get_instance(manager_list.next, fibril_t, link);
    210211                if (serialization_count && stype == FIBRIL_TO_MANAGER) {
    211                         serialized_fibrils++;
     212                        serialized_threads++;
    212213                        srcf->flags |= FIBRIL_SERIALIZED;
    213214                }
    214                 fibrils_in_manager++;
     215                threads_in_manager++;
    215216
    216217                if (stype == FIBRIL_FROM_DEAD)
     
    220221                        dstf = list_get_instance(serialized_list.next, fibril_t,
    221222                            link);
    222                         serialized_fibrils--;
     223                        serialized_threads--;
    223224                } else {
    224225                        dstf = list_get_instance(ready_list.next, fibril_t,
     
    270271/** Add a fibril to the ready list.
    271272 *
    272  * @param fid           Pinter to the fibril structure of the fibril to be
     273 * @param fid           Pointer to the fibril structure of the fibril to be
    273274 *                      added.
    274275 */
     
    288289/** Add a fibril to the manager list.
    289290 *
    290  * @param fid           Pinter to the fibril structure of the fibril to be added.
     291 * @param fid           Pointer to the fibril structure of the fibril to be
     292 *                      added.
    291293 */
    292294void fibril_add_manager(fid_t fid)
     
    315317/** Return fibril id of the currently running fibril.
    316318 *
    317  * @return              Fibril ID of the currently running pseudo thread.
     319 * @return              Fibril ID of the currently running fibril.
    318320 */
    319321fid_t fibril_get_id(void)
Note: See TracChangeset for help on using the changeset viewer.