Ignore:
Timestamp:
2019-05-28T19:24:14Z (5 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
77de449e
Parents:
af5037d (diff), bebd154 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-05-28 19:24:14)
git-committer:
GitHub <noreply@…> (2019-05-28 19:24:14)
Message:

Merge pull request #161 from le-jzr/cxxcompat2

C++ compatibility improvements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/cpp/include/__bits/thread/threading.hpp

    raf5037d r52acfab  
    3030#define LIBCPP_BITS_THREAD_THREADING
    3131
    32 namespace std::hel
    33 {
    34     extern "C" {
    35         #include <fibril.h>
    36         #include <fibril_synch.h>
    37     }
    38 }
    39 
    4032#include <chrono>
     33
     34#include <fibril.h>
     35#include <fibril_synch.h>
    4136
    4237namespace std::aux
     
    5449    struct threading_policy<fibril_tag>
    5550    {
    56         using mutex_type        = hel::fibril_mutex_t;
    57         using thread_type       = hel::fid_t;
    58         using condvar_type      = hel::fibril_condvar_t;
    59         using time_unit         = hel::usec_t;
    60         using shared_mutex_type = hel::fibril_rwlock_t;
     51        using mutex_type        = ::helenos::fibril_mutex_t;
     52        using thread_type       = ::helenos::fid_t;
     53        using condvar_type      = ::helenos::fibril_condvar_t;
     54        using time_unit         = ::helenos::usec_t;
     55        using shared_mutex_type = ::helenos::fibril_rwlock_t;
    6156
    6257        struct thread
     
    6560            static thread_type create(Callable clbl, Payload& pld)
    6661            {
    67                 return hel::fibril_create(clbl, (void*)&pld);
     62                return ::helenos::fibril_create(clbl, (void*)&pld);
    6863            }
    6964
    7065            static void start(thread_type thr)
    7166            {
    72                 hel::fibril_add_ready(thr);
     67                ::helenos::fibril_add_ready(thr);
    7368            }
    7469
    7570            static thread_type this_thread()
    7671            {
    77                 return hel::fibril_get_id();
     72                return ::helenos::fibril_get_id();
    7873            }
    7974
    8075            static void yield()
    8176            {
    82                 hel::fibril_yield();
     77                ::helenos::fibril_yield();
    8378            }
    8479
     
    9489            static void init(mutex_type& mtx)
    9590            {
    96                 hel::fibril_mutex_initialize(&mtx);
     91                ::helenos::fibril_mutex_initialize(&mtx);
    9792            }
    9893
    9994            static void lock(mutex_type& mtx)
    10095            {
    101                 hel::fibril_mutex_lock(&mtx);
     96                ::helenos::fibril_mutex_lock(&mtx);
    10297            }
    10398
    10499            static void unlock(mutex_type& mtx)
    105100            {
    106                 hel::fibril_mutex_unlock(&mtx);
     101                ::helenos::fibril_mutex_unlock(&mtx);
    107102            }
    108103
    109104            static bool try_lock(mutex_type& mtx)
    110105            {
    111                 return hel::fibril_mutex_trylock(&mtx);
     106                return ::helenos::fibril_mutex_trylock(&mtx);
    112107            }
    113108
     
    123118            static void init(condvar_type& cv)
    124119            {
    125                 hel::fibril_condvar_initialize(&cv);
     120                ::helenos::fibril_condvar_initialize(&cv);
    126121            }
    127122
    128123            static void wait(condvar_type& cv, mutex_type& mtx)
    129124            {
    130                 hel::fibril_condvar_wait(&cv, &mtx);
     125                ::helenos::fibril_condvar_wait(&cv, &mtx);
    131126            }
    132127
    133128            static int wait_for(condvar_type& cv, mutex_type& mtx, time_unit timeout)
    134129            {
    135                 return hel::fibril_condvar_wait_timeout(&cv, &mtx, timeout);
     130                return ::helenos::fibril_condvar_wait_timeout(&cv, &mtx, timeout);
    136131            }
    137132
    138133            static void signal(condvar_type& cv)
    139134            {
    140                 hel::fibril_condvar_signal(&cv);
     135                ::helenos::fibril_condvar_signal(&cv);
    141136            }
    142137
    143138            static void broadcast(condvar_type& cv)
    144139            {
    145                 hel::fibril_condvar_broadcast(&cv);
     140                ::helenos::fibril_condvar_broadcast(&cv);
    146141            }
    147142        };
     
    157152            static void sleep(time_unit time)
    158153            {
    159                 hel::fibril_usleep(time);
     154                ::helenos::fibril_usleep(time);
    160155            }
    161156        };
     
    165160            static void init(shared_mutex_type& mtx)
    166161            {
    167                 hel::fibril_rwlock_initialize(&mtx);
     162                ::helenos::fibril_rwlock_initialize(&mtx);
    168163            }
    169164
    170165            static void lock(shared_mutex_type& mtx)
    171166            {
    172                 hel::fibril_rwlock_write_lock(&mtx);
     167                ::helenos::fibril_rwlock_write_lock(&mtx);
    173168            }
    174169
    175170            static void unlock(shared_mutex_type& mtx)
    176171            {
    177                 hel::fibril_rwlock_write_unlock(&mtx);
     172                ::helenos::fibril_rwlock_write_unlock(&mtx);
    178173            }
    179174
    180175            static void lock_shared(shared_mutex_type& mtx)
    181176            {
    182                 hel::fibril_rwlock_read_lock(&mtx);
     177                ::helenos::fibril_rwlock_read_lock(&mtx);
    183178            }
    184179
    185180            static void unlock_shared(shared_mutex_type& mtx)
    186181            {
    187                 hel::fibril_rwlock_read_unlock(&mtx);
     182                ::helenos::fibril_rwlock_read_unlock(&mtx);
    188183            }
    189184
Note: See TracChangeset for help on using the changeset viewer.