1d6b92ffaSHans Petter Selasky /* 2d6b92ffaSHans Petter Selasky * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved. 3d6b92ffaSHans Petter Selasky * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4d6b92ffaSHans Petter Selasky * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5d6b92ffaSHans Petter Selasky * 6d6b92ffaSHans Petter Selasky * This software is available to you under a choice of one of two 7d6b92ffaSHans Petter Selasky * licenses. You may choose to be licensed under the terms of the GNU 8d6b92ffaSHans Petter Selasky * General Public License (GPL) Version 2, available from the file 9d6b92ffaSHans Petter Selasky * COPYING in the main directory of this source tree, or the 10d6b92ffaSHans Petter Selasky * OpenIB.org BSD license below: 11d6b92ffaSHans Petter Selasky * 12d6b92ffaSHans Petter Selasky * Redistribution and use in source and binary forms, with or 13d6b92ffaSHans Petter Selasky * without modification, are permitted provided that the following 14d6b92ffaSHans Petter Selasky * conditions are met: 15d6b92ffaSHans Petter Selasky * 16d6b92ffaSHans Petter Selasky * - Redistributions of source code must retain the above 17d6b92ffaSHans Petter Selasky * copyright notice, this list of conditions and the following 18d6b92ffaSHans Petter Selasky * disclaimer. 19d6b92ffaSHans Petter Selasky * 20d6b92ffaSHans Petter Selasky * - Redistributions in binary form must reproduce the above 21d6b92ffaSHans Petter Selasky * copyright notice, this list of conditions and the following 22d6b92ffaSHans Petter Selasky * disclaimer in the documentation and/or other materials 23d6b92ffaSHans Petter Selasky * provided with the distribution. 24d6b92ffaSHans Petter Selasky * 25d6b92ffaSHans Petter Selasky * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26d6b92ffaSHans Petter Selasky * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27d6b92ffaSHans Petter Selasky * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28d6b92ffaSHans Petter Selasky * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29d6b92ffaSHans Petter Selasky * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30d6b92ffaSHans Petter Selasky * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31d6b92ffaSHans Petter Selasky * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32d6b92ffaSHans Petter Selasky * SOFTWARE. 33d6b92ffaSHans Petter Selasky * 34d6b92ffaSHans Petter Selasky */ 35d6b92ffaSHans Petter Selasky 36d6b92ffaSHans Petter Selasky /* 37d6b92ffaSHans Petter Selasky * Abstract: 38d6b92ffaSHans Petter Selasky * Implementation of spin lock object. 39d6b92ffaSHans Petter Selasky */ 40d6b92ffaSHans Petter Selasky 41d6b92ffaSHans Petter Selasky #ifndef _CL_SPINLOCK_OSD_H_ 42d6b92ffaSHans Petter Selasky #define _CL_SPINLOCK_OSD_H_ 43d6b92ffaSHans Petter Selasky 44d6b92ffaSHans Petter Selasky #ifdef __cplusplus 45d6b92ffaSHans Petter Selasky # define BEGIN_C_DECLS extern "C" { 46d6b92ffaSHans Petter Selasky # define END_C_DECLS } 47d6b92ffaSHans Petter Selasky #else /* !__cplusplus */ 48d6b92ffaSHans Petter Selasky # define BEGIN_C_DECLS 49d6b92ffaSHans Petter Selasky # define END_C_DECLS 50d6b92ffaSHans Petter Selasky #endif /* __cplusplus */ 51d6b92ffaSHans Petter Selasky 52d6b92ffaSHans Petter Selasky BEGIN_C_DECLS 53d6b92ffaSHans Petter Selasky #include <complib/cl_types.h> 54d6b92ffaSHans Petter Selasky #include <pthread.h> /* usr/include/ */ 55d6b92ffaSHans Petter Selasky typedef struct _cl_spinlock_t { 56d6b92ffaSHans Petter Selasky pthread_mutex_t mutex; 57d6b92ffaSHans Petter Selasky cl_state_t state; 58d6b92ffaSHans Petter Selasky } cl_spinlock_t; 59d6b92ffaSHans Petter Selasky 60d6b92ffaSHans Petter Selasky END_C_DECLS 61d6b92ffaSHans Petter Selasky #endif /* _CL_SPINLOCK_OSD_H_ */ 62