From ae52943045f4a6b0801da7f4c534d84755f47d9c Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Thu, 24 Feb 2011 09:33:02 +0100 Subject: [PATCH] seperate the declaration of the data type spinlock and the implementation of a spinlock --- include/metalsvm/spinlock.h | 8 +----- include/metalsvm/spinlock_types.h | 41 +++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 include/metalsvm/spinlock_types.h diff --git a/include/metalsvm/spinlock.h b/include/metalsvm/spinlock.h index eb90ec9c..ae4b44ac 100644 --- a/include/metalsvm/spinlock.h +++ b/include/metalsvm/spinlock.h @@ -21,6 +21,7 @@ #define __SPINLOCK_H__ #include +#include #include #include #include @@ -29,13 +30,6 @@ extern "C" { #endif -typedef struct spinlock { - atomic_int32_t queue, dequeue; - tid_t owner; -} spinlock_t; - -#define SPINLOCK_INIT { ATOMIC_INIT(0), ATOMIC_INIT(1), MAX_TASKS } - inline static int spinlock_init(spinlock_t* s) { if (BUILTIN_EXPECT(!s, 0)) return -1; diff --git a/include/metalsvm/spinlock_types.h b/include/metalsvm/spinlock_types.h new file mode 100644 index 00000000..a7bd82b6 --- /dev/null +++ b/include/metalsvm/spinlock_types.h @@ -0,0 +1,41 @@ +/* + * Copyright 2011 Stefan Lankes, Chair for Operating Systems, + * RWTH Aachen University + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * This file is part of MetalSVM. + */ + +#ifndef __SPINLOCK_TYPES_H__ +#define __SPINLOCK_TYPES_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct spinlock { + atomic_int32_t queue, dequeue; + tid_t owner; +} spinlock_t; + +#define SPINLOCK_INIT { ATOMIC_INIT(0), ATOMIC_INIT(1), MAX_TASKS } + +#ifdef __cplusplus +} +#endif + +#endif