C

[C] Initalized struct

Posted by Jarxi on 2020-02-25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
enum mutexstate
{
MDESTROYED,
MLOCKED,
MUNLOCKED
};


struct kthread_mutex_t
{
int mid;
enum mutexstate state;
};

struct
{
struct spinlock lock;
struct kthread_mutex_t mutexes[MAX_MUTEXES];
} mtable;

Every mutex->state in mutexes will be initialized to MDESTROYED as MDESTROYED is the first in enum.



支付宝打赏 微信打赏

赞赏一下