Changeset 015b147 in mainline for uspace/srv/sysman/repo.h


Ignore:
Timestamp:
2019-08-17T13:52:32Z (5 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
be07995
Parents:
31ef7c1
git-author:
Michal Koutný <xm.koutny+hos@…> (2016-01-10 17:17:19)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-08-17 13:52:32)
Message:

sysman: Refactored unit repo iteration and locking

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/sysman/repo.h

    r31ef7c1 r015b147  
    3838#define ANONYMOUS_SERVICE_MASK "service_%" PRIu64
    3939
    40 /*
    41  * If you access units out of the main event-loop fibril call repo_rlock(),
    42  * repo_runlock().
     40/**
     41 * Don't access this structure directly, use repo_foreach instead.
    4342 */
    44 extern list_t units;
     43extern list_t units_;
     44
     45/**
     46 * If you iterate units out of the main event-loop fibril, wrap the foreach
     47 * into repo_rlock() and repo_runlock().
     48 *
     49 * @param  it  name of unit_t * loop iterator variable
     50 */
     51#define repo_foreach(_it) \
     52        list_foreach(units_, units, unit_t, _it)
     53
     54/**
     55 * @see repo_foreach
     56 *
     57 * @param type  unit_type_t  restrict to units of type only
     58 * @param it                 name of unit_t * loop iterator variable
     59 */
     60#define repo_foreach_t(_type, _it) \
     61        list_foreach(units_, units, unit_t, _it) \
     62                if (_it->type == (_type))
    4563
    4664extern void repo_init(void);
     
    5876
    5977extern unit_t *repo_find_unit_by_name(const char *);
     78extern unit_t *repo_find_unit_by_name_unsafe(const char *);
    6079extern unit_t *repo_find_unit_by_handle(unit_handle_t);
    6180
Note: See TracChangeset for help on using the changeset viewer.