Changeset d5409da in mainline


Ignore:
Timestamp:
2023-10-22T17:26:17Z (7 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e8c235b
Parents:
f0378c6
git-author:
Vojtech Horky <vojtech.horky@…> (2023-07-13 20:05:54)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-10-22 17:26:17)
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

    rf0378c6 rd5409da  
    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

    rf0378c6 rd5409da  
    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

    rf0378c6 rd5409da  
    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

    rf0378c6 rd5409da  
    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.