1a9643ea8Slogwang /*- 2a9643ea8Slogwang * BSD LICENSE 3a9643ea8Slogwang * 4a9643ea8Slogwang * Copyright(c) 2015 Intel Corporation. All rights reserved. 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 9a9643ea8Slogwang * are met: 10a9643ea8Slogwang * 11a9643ea8Slogwang * * Redistributions of source code must retain the above copyright 12a9643ea8Slogwang * notice, this list of conditions and the following disclaimer. 13a9643ea8Slogwang * * Redistributions in binary form must reproduce the above copyright 14a9643ea8Slogwang * notice, this list of conditions and the following disclaimer in 15a9643ea8Slogwang * the documentation and/or other materials provided with the 16a9643ea8Slogwang * distribution. 17a9643ea8Slogwang * * Neither the name of Intel Corporation nor the names of its 18a9643ea8Slogwang * contributors may be used to endorse or promote products derived 19a9643ea8Slogwang * from this software without specific prior written permission. 20a9643ea8Slogwang * 21a9643ea8Slogwang * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22a9643ea8Slogwang * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23a9643ea8Slogwang * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24a9643ea8Slogwang * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25a9643ea8Slogwang * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26a9643ea8Slogwang * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27a9643ea8Slogwang * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28a9643ea8Slogwang * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29a9643ea8Slogwang * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30a9643ea8Slogwang * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31a9643ea8Slogwang * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32a9643ea8Slogwang */ 33a9643ea8Slogwang 34a9643ea8Slogwang 35a9643ea8Slogwang #ifndef LTHREAD_MUTEX_H_ 36a9643ea8Slogwang #define LTHREAD_MUTEX_H_ 37a9643ea8Slogwang 38*2bfe3f2eSlogwang #ifdef __cplusplus 39*2bfe3f2eSlogwang extern "C" { 40*2bfe3f2eSlogwang #endif 41*2bfe3f2eSlogwang 42a9643ea8Slogwang #include "lthread_queue.h" 43a9643ea8Slogwang 44a9643ea8Slogwang 45a9643ea8Slogwang #define MAX_MUTEX_NAME_SIZE 64 46a9643ea8Slogwang 47a9643ea8Slogwang struct lthread_mutex { 48a9643ea8Slogwang struct lthread *owner; 49a9643ea8Slogwang rte_atomic64_t count; 50a9643ea8Slogwang struct lthread_queue *blocked __rte_cache_aligned; 51a9643ea8Slogwang struct lthread_sched *root_sched; 52a9643ea8Slogwang char name[MAX_MUTEX_NAME_SIZE]; 53a9643ea8Slogwang uint64_t diag_ref; /* optional ref to user diag data */ 54a9643ea8Slogwang } __rte_cache_aligned; 55a9643ea8Slogwang 56*2bfe3f2eSlogwang #ifdef __cplusplus 57*2bfe3f2eSlogwang } 58*2bfe3f2eSlogwang #endif 59*2bfe3f2eSlogwang 60a9643ea8Slogwang #endif /* LTHREAD_MUTEX_H_ */ 61