Changeset 261bbdc in mainline


Ignore:
Timestamp:
2012-01-12T08:48:51Z (12 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
99c2e9f3
Parents:
5923cf82
Message:

remcons: attribute renaming

Location:
uspace/srv/hid/remcons
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/remcons/remcons.c

    r5923cf82 r261bbdc  
    104104                        callid = async_get_call_timeout(&call, 1000);
    105105
    106                         fibril_mutex_lock(&user->refcount_mutex);
     106                        fibril_mutex_lock(&user->guard);
    107107                        bool bail_out = user->socket_closed || user->task_finished;
    108                         fibril_mutex_unlock(&user->refcount_mutex);
     108                        fibril_mutex_unlock(&user->guard);
    109109
    110110                        if (bail_out) {
     
    134134                                        int recv_length = recv(user->socket, user->socket_buffer, BUFFER_SIZE, 0);
    135135                                        if ((recv_length == 0) || (recv_length == ENOTCONN)) {
    136                                                 fibril_mutex_lock(&user->refcount_mutex);
     136                                                fibril_mutex_lock(&user->guard);
    137137                                                user->socket_closed = true;
    138                                                 fibril_mutex_unlock(&user->refcount_mutex);
     138                                                fibril_mutex_unlock(&user->guard);
    139139                                                async_answer_0(callid, ENOENT);
    140140                                                return;
     
    283283                telnet_user_error(user, "Spawning %s %s %s failed: %s.",
    284284                    APP_GETTERM, term, "/app/bdsh", str_error(rc));
    285                 fibril_mutex_lock(&user->refcount_mutex);
     285                fibril_mutex_lock(&user->guard);
    286286                user->task_finished = true;
    287287                fibril_condvar_signal(&user->refcount_cv);
    288                 fibril_mutex_unlock(&user->refcount_mutex);
     288                fibril_mutex_unlock(&user->guard);
    289289                return EOK;
    290290        }
    291291
    292         fibril_mutex_lock(&user->refcount_mutex);
     292        fibril_mutex_lock(&user->guard);
    293293        user->task_id = task;
    294         fibril_mutex_unlock(&user->refcount_mutex);
     294        fibril_mutex_unlock(&user->guard);
    295295
    296296        task_exit_t task_exit;
     
    302302
    303303        /* Announce destruction. */
    304         fibril_mutex_lock(&user->refcount_mutex);
     304        fibril_mutex_lock(&user->guard);
    305305        user->task_finished = true;
    306306        fibril_condvar_signal(&user->refcount_cv);
    307         fibril_mutex_unlock(&user->refcount_mutex);
     307        fibril_mutex_unlock(&user->guard);
    308308
    309309        return EOK;
     
    344344
    345345        /* Wait for all clients to exit. */
    346         fibril_mutex_lock(&user->refcount_mutex);
     346        fibril_mutex_lock(&user->guard);
    347347        while (!user_can_be_destroyed_no_lock(user)) {
    348348                if (user->task_finished) {
     
    355355                        }
    356356                }
    357                 fibril_condvar_wait_timeout(&user->refcount_cv, &user->refcount_mutex, 1000);
    358         }
    359         fibril_mutex_unlock(&user->refcount_mutex);
     357                fibril_condvar_wait_timeout(&user->refcount_cv, &user->guard, 1000);
     358        }
     359        fibril_mutex_unlock(&user->guard);
    360360
    361361        rc = loc_service_unregister(user->service_id);
  • uspace/srv/hid/remcons/user.c

    r5923cf82 r261bbdc  
    8989
    9090        fibril_condvar_initialize(&user->refcount_cv);
    91         fibril_mutex_initialize(&user->refcount_mutex);
     91        fibril_mutex_initialize(&user->guard);
    9292        user->task_finished = false;
    9393        user->socket_closed = false;
     
    139139
    140140        telnet_user_t *tmp = user;
    141         fibril_mutex_lock(&tmp->refcount_mutex);
     141        fibril_mutex_lock(&tmp->guard);
    142142        user->locsrv_connection_count++;
    143143
     
    151151        }
    152152
    153         fibril_mutex_unlock(&tmp->refcount_mutex);
     153        fibril_mutex_unlock(&tmp->guard);
    154154
    155155
     
    165165void telnet_user_notify_client_disconnected(telnet_user_t *user)
    166166{
    167         fibril_mutex_lock(&user->refcount_mutex);
     167        fibril_mutex_lock(&user->guard);
    168168        assert(user->locsrv_connection_count > 0);
    169169        user->locsrv_connection_count--;
    170170        fibril_condvar_signal(&user->refcount_cv);
    171         fibril_mutex_unlock(&user->refcount_mutex);
     171        fibril_mutex_unlock(&user->guard);
    172172}
    173173
  • uspace/srv/hid/remcons/user.h

    r5923cf82 r261bbdc  
    4444/** Representation of a connected (human) user. */
    4545typedef struct {
     46        /** Mutex guarding the whole structure. */
     47        fibril_mutex_t guard;
     48
    4649        /** Internal id, used for creating locfs entries. */
    4750        int id;
     
    6568        /* Reference counting. */
    6669        fibril_condvar_t refcount_cv;
    67         fibril_mutex_t refcount_mutex;
    6870        bool task_finished;
    6971        int locsrv_connection_count;
Note: See TracChangeset for help on using the changeset viewer.