xref: /f-stack/lib/include/sys/_rwlock.h (revision 2317ada5)
1a9643ea8Slogwang /*
2a9643ea8Slogwang  * Copyright (c) 2010 Kip Macy All rights reserved.
3a9643ea8Slogwang  * Copyright (c) 2013 Patrick Kelsey. All rights reserved.
4*2317ada5Sfengbojiang  * Copyright (C) 2017-2021 THL A29 Limited, a Tencent company.
5a9643ea8Slogwang  * All rights reserved.
6a9643ea8Slogwang  *
7a9643ea8Slogwang  * Redistribution and use in source and binary forms, with or without
8a9643ea8Slogwang  * modification, are permitted provided that the following conditions are met:
9a9643ea8Slogwang  *
10a9643ea8Slogwang  * 1. Redistributions of source code must retain the above copyright notice, this
11a9643ea8Slogwang  *   list of conditions and the following disclaimer.
12a9643ea8Slogwang  * 2. Redistributions in binary form must reproduce the above copyright notice,
13a9643ea8Slogwang  *   this list of conditions and the following disclaimer in the documentation
14a9643ea8Slogwang  *   and/or other materials provided with the distribution.
15a9643ea8Slogwang  *
16a9643ea8Slogwang  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17a9643ea8Slogwang  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18a9643ea8Slogwang  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19a9643ea8Slogwang  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
20a9643ea8Slogwang  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21a9643ea8Slogwang  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22a9643ea8Slogwang  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23a9643ea8Slogwang  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24a9643ea8Slogwang  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25a9643ea8Slogwang  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26a9643ea8Slogwang  *
27a9643ea8Slogwang  */
28a9643ea8Slogwang 
29a9643ea8Slogwang #ifndef _FSTACK_SYS__RWLOCK_H_
30a9643ea8Slogwang #define _FSTACK_SYS__RWLOCK_H_
31a9643ea8Slogwang 
32a9643ea8Slogwang #include "ff_host_interface.h"
33a9643ea8Slogwang 
34a9643ea8Slogwang /*
35a9643ea8Slogwang  * Reader/writer lock.
36a9643ea8Slogwang  */
37a9643ea8Slogwang struct rwlock {
38a9643ea8Slogwang     struct lock_object lock_object;
39a9643ea8Slogwang     ff_rwlock_t rw_lock;
40a9643ea8Slogwang };
41a9643ea8Slogwang 
42a9643ea8Slogwang struct rwlock_padalign {
43a9643ea8Slogwang     struct lock_object lock_object;
44a9643ea8Slogwang     ff_rwlock_t rw_lock;
45a9643ea8Slogwang } __aligned(CACHE_LINE_SIZE);
46a9643ea8Slogwang 
47a9643ea8Slogwang #endif    /* _FSTACK_SYS__RWLOCK_H_ */
48