Changeset bc56f30 in mainline for uspace/lib/cpp/include/__bits
- Timestamp:
- 2019-05-27T12:38:26Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0d14c25
- Parents:
- 4d51c60
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-13 16:06:49)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2019-05-27 12:38:26)
- Location:
- uspace/lib/cpp/include/__bits
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/__bits/chrono.hpp
r4d51c60 rbc56f30 611 611 static time_point now() 612 612 { 613 hel::timespec ts{};614 hel::getrealtime(&ts);613 ::std::timespec ts{}; 614 ::helenos::getrealtime(&ts); 615 615 616 616 rep time = NSEC2USEC(ts.tv_nsec); … … 654 654 static time_point now() 655 655 { 656 hel::timespec ts{};657 hel::getuptime(&ts);656 ::std::timespec ts{}; 657 ::helenos::getuptime(&ts); 658 658 659 659 rep time = NSEC2USEC(ts.tv_nsec); -
uspace/lib/cpp/include/__bits/io/ios.hpp
r4d51c60 rbc56f30 41 41 { 42 42 using streamoff = long long; 43 using streamsize = hel::ssize_t;43 using streamsize = ::ssize_t; 44 44 45 45 /** -
uspace/lib/cpp/include/__bits/limits.hpp
r4d51c60 rbc56f30 528 528 static constexpr unsigned short min() 529 529 { 530 return USHRT_MIN;530 return 0; 531 531 } 532 532 … … 552 552 static constexpr unsigned int min() 553 553 { 554 return UINT_MIN;554 return 0; 555 555 } 556 556 … … 576 576 static constexpr unsigned long min() 577 577 { 578 return ULONG_MIN;578 return 0; 579 579 } 580 580 … … 600 600 static constexpr unsigned long long min() 601 601 { 602 return ULLONG_MIN;602 return 0; 603 603 } 604 604 -
uspace/lib/cpp/include/__bits/locale/num_get.hpp
r4d51c60 rbc56f30 301 301 if (size > 0) 302 302 { 303 int ret{}; 303 int olderrno{errno}; 304 errno = EOK; 305 304 306 if constexpr (is_signed<BaseType>::value) 305 ret = std::hel::str_int64_t(base.buffer_, nullptr, num_base, false, &res); 306 else 307 ret = std::hel::str_uint64_t(base.buffer_, nullptr, num_base, false, &res); 308 309 if (ret != EOK) 310 { 307 res = ::strtoll(base.buffer_, nullptr, num_base); 308 else 309 res = ::strtoull(base.buffer_, nullptr, num_base); 310 311 if (errno != EOK) 311 312 err |= ios_base::failbit; 312 v = 0; 313 } 314 else if (res > static_cast<BaseType>(numeric_limits<T>::max())) 313 314 errno = olderrno; 315 316 if (res > static_cast<BaseType>(numeric_limits<T>::max())) 315 317 { 316 318 err |= ios_base::failbit; -
uspace/lib/cpp/include/__bits/random.hpp
r4d51c60 rbc56f30 1030 1030 * something better. 1031 1031 */ 1032 hel::srand(hel::time(nullptr));1032 ::srand(::time(nullptr)); 1033 1033 } 1034 1034 1035 1035 result_type operator()() 1036 1036 { 1037 return hel::rand();1037 return ::rand(); 1038 1038 } 1039 1039 -
uspace/lib/cpp/include/__bits/string/string.hpp
r4d51c60 rbc56f30 82 82 static int compare(const char_type* s1, const char_type* s2, size_t n) 83 83 { 84 return hel::str_lcmp(s1, s2, n);84 return ::strncmp(s1, s2, n); 85 85 } 86 86 87 87 static size_t length(const char_type* s) 88 88 { 89 return hel::str_size(s);89 return ::strlen(s); 90 90 } 91 91 … … 367 367 // TODO: This function does not exits... 368 368 __unimplemented(); 369 //return hel::wstr_lcmp(s1, s2, n);370 369 return 0; 371 370 } … … 373 372 static size_t length(const char_type* s) 374 373 { 375 return hel::wstr_size(s); 374 size_t i = 0; 375 while (s[i] != 0) 376 i++; 377 return i; 376 378 } 377 379 -
uspace/lib/cpp/include/__bits/thread/condition_variable.hpp
r4d51c60 rbc56f30 35 35 namespace std 36 36 { 37 extern "C" {38 #include <fibril.h>39 #include <fibril_synch.h>40 }41 42 37 enum class cv_status 43 38 { -
uspace/lib/cpp/include/__bits/thread/threading.hpp
r4d51c60 rbc56f30 30 30 #define LIBCPP_BITS_THREAD_THREADING 31 31 32 namespace std::hel33 {34 extern "C" {35 #include <fibril.h>36 #include <fibril_synch.h>37 }38 }39 40 32 #include <chrono> 33 34 #include <fibril.h> 35 #include <fibril_synch.h> 41 36 42 37 namespace std::aux … … 54 49 struct threading_policy<fibril_tag> 55 50 { 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; 61 56 62 57 struct thread … … 65 60 static thread_type create(Callable clbl, Payload& pld) 66 61 { 67 return hel::fibril_create(clbl, (void*)&pld);62 return ::helenos::fibril_create(clbl, (void*)&pld); 68 63 } 69 64 70 65 static void start(thread_type thr) 71 66 { 72 hel::fibril_add_ready(thr);67 ::helenos::fibril_add_ready(thr); 73 68 } 74 69 75 70 static thread_type this_thread() 76 71 { 77 return hel::fibril_get_id();72 return ::helenos::fibril_get_id(); 78 73 } 79 74 80 75 static void yield() 81 76 { 82 hel::fibril_yield();77 ::helenos::fibril_yield(); 83 78 } 84 79 … … 94 89 static void init(mutex_type& mtx) 95 90 { 96 hel::fibril_mutex_initialize(&mtx);91 ::helenos::fibril_mutex_initialize(&mtx); 97 92 } 98 93 99 94 static void lock(mutex_type& mtx) 100 95 { 101 hel::fibril_mutex_lock(&mtx);96 ::helenos::fibril_mutex_lock(&mtx); 102 97 } 103 98 104 99 static void unlock(mutex_type& mtx) 105 100 { 106 hel::fibril_mutex_unlock(&mtx);101 ::helenos::fibril_mutex_unlock(&mtx); 107 102 } 108 103 109 104 static bool try_lock(mutex_type& mtx) 110 105 { 111 return hel::fibril_mutex_trylock(&mtx);106 return ::helenos::fibril_mutex_trylock(&mtx); 112 107 } 113 108 … … 123 118 static void init(condvar_type& cv) 124 119 { 125 hel::fibril_condvar_initialize(&cv);120 ::helenos::fibril_condvar_initialize(&cv); 126 121 } 127 122 128 123 static void wait(condvar_type& cv, mutex_type& mtx) 129 124 { 130 hel::fibril_condvar_wait(&cv, &mtx);125 ::helenos::fibril_condvar_wait(&cv, &mtx); 131 126 } 132 127 133 128 static int wait_for(condvar_type& cv, mutex_type& mtx, time_unit timeout) 134 129 { 135 return hel::fibril_condvar_wait_timeout(&cv, &mtx, timeout);130 return ::helenos::fibril_condvar_wait_timeout(&cv, &mtx, timeout); 136 131 } 137 132 138 133 static void signal(condvar_type& cv) 139 134 { 140 hel::fibril_condvar_signal(&cv);135 ::helenos::fibril_condvar_signal(&cv); 141 136 } 142 137 143 138 static void broadcast(condvar_type& cv) 144 139 { 145 hel::fibril_condvar_broadcast(&cv);140 ::helenos::fibril_condvar_broadcast(&cv); 146 141 } 147 142 }; … … 157 152 static void sleep(time_unit time) 158 153 { 159 hel::fibril_usleep(time);154 ::helenos::fibril_usleep(time); 160 155 } 161 156 }; … … 165 160 static void init(shared_mutex_type& mtx) 166 161 { 167 hel::fibril_rwlock_initialize(&mtx);162 ::helenos::fibril_rwlock_initialize(&mtx); 168 163 } 169 164 170 165 static void lock(shared_mutex_type& mtx) 171 166 { 172 hel::fibril_rwlock_write_lock(&mtx);167 ::helenos::fibril_rwlock_write_lock(&mtx); 173 168 } 174 169 175 170 static void unlock(shared_mutex_type& mtx) 176 171 { 177 hel::fibril_rwlock_write_unlock(&mtx);172 ::helenos::fibril_rwlock_write_unlock(&mtx); 178 173 } 179 174 180 175 static void lock_shared(shared_mutex_type& mtx) 181 176 { 182 hel::fibril_rwlock_read_lock(&mtx);177 ::helenos::fibril_rwlock_read_lock(&mtx); 183 178 } 184 179 185 180 static void unlock_shared(shared_mutex_type& mtx) 186 181 { 187 hel::fibril_rwlock_read_unlock(&mtx);182 ::helenos::fibril_rwlock_read_unlock(&mtx); 188 183 } 189 184
Note:
See TracChangeset
for help on using the changeset viewer.