Changeset c4c90c8 in mainline


Ignore:
Timestamp:
2023-07-14T12:41:19Z (11 months ago)
Author:
Vojtech Horky <vojtech.horky@…>
Branches:
ticket/834-toolchain-update
Children:
10e56b7
Parents:
b030416
git-author:
Vojtech Horky <vojtech.horky@…> (2023-07-13 20:05:54)
git-committer:
Vojtech Horky <vojtech.horky@…> (2023-07-14 12:41:19)
Message:

C++: mutex::init should be constexpr

Location:
uspace/lib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/thread/fibril_synch.c

    rb030416 rc4c90c8  
    160160{
    161161        check_fibril_for_deadlock(oi, fibril_self());
    162 }
    163 
    164 void fibril_mutex_initialize(fibril_mutex_t *fm)
    165 {
    166         fm->oi.owned_by = NULL;
    167         fm->counter = 1;
    168         list_initialize(&fm->waiters);
    169162}
    170163
  • uspace/lib/c/include/adt/list.h

    rb030416 rc4c90c8  
    183183 *
    184184 */
    185 _NO_TRACE static inline void list_initialize(list_t *list)
     185_NO_TRACE static inline __CONSTEXPR void list_initialize(list_t *list)
    186186{
    187187        list->head.prev = &list->head;
  • uspace/lib/c/include/fibril_synch.h

    rb030416 rc4c90c8  
    153153extern void __fibril_synch_fini(void);
    154154
    155 extern void fibril_mutex_initialize(fibril_mutex_t *);
     155/** Initialize fibril mutex.
     156 *
     157 * Kept as in-line to allow constexpr marker for C++ library where this
     158 * is used by C++ mutex type (list initialization are two assignments
     159 * so it is actually reasonable to have this inlined).
     160 */
     161static inline __CONSTEXPR void fibril_mutex_initialize(fibril_mutex_t *fm)
     162{
     163        fm->oi.owned_by = NULL;
     164        fm->counter = 1;
     165        list_initialize(&fm->waiters);
     166}
     167
    156168extern void fibril_mutex_lock(fibril_mutex_t *);
    157169extern bool fibril_mutex_trylock(fibril_mutex_t *);
  • uspace/lib/cpp/include/__bits/thread/threading.hpp

    rb030416 rc4c90c8  
    8787        struct mutex
    8888        {
    89             static void init(mutex_type& mtx)
     89            static constexpr void init(mutex_type& mtx)
    9090            {
    9191                ::helenos::fibril_mutex_initialize(&mtx);
Note: See TracChangeset for help on using the changeset viewer.