GNU Radio 3.4.0 C++ API
gc_jd_stack.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2007 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License along
00018  * with this program; if not, write to the Free Software Foundation, Inc.,
00019  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00020  */
00021 
00022 #ifndef INCLUDED_GCELL_GC_JD_STACK_H
00023 #define INCLUDED_GCELL_GC_JD_STACK_H
00024 
00025 #include <gcell/gc_types.h>
00026 #include <gcell/gc_job_desc.h>
00027 
00028 __GC_BEGIN_DECLS
00029 
00030 /*!
00031  * \brief Lock free stack for job descriptors (used for free list)
00032  *
00033  * This is aligned to a cache line, and fills the cache line,
00034  * to avoid inadvertently losing reservations created with
00035  * the load-and-reserve instructions.
00036  */
00037 
00038 typedef struct gc_jd_stack
00039 {
00040   gc_eaddr_t    top;
00041 
00042   // pad out to a full cache line
00043   uint8_t       _pad[128 - sizeof(gc_eaddr_t)];
00044 } _AL128 gc_jd_stack_t;
00045 
00046 
00047 /*!
00048  * \brief Initialize the stack to empty.
00049  */
00050 void 
00051 gc_jd_stack_init(gc_jd_stack_t *stack);
00052   
00053 
00054 /*!
00055  * \brief Add \p item to the top of \p stack.
00056  */
00057 void 
00058 gc_jd_stack_push(gc_jd_stack_t *stack, gc_job_desc_t *item);
00059 
00060 
00061 /*!
00062  * \brief pop and return top item on stack, or 0 if stack is empty
00063  */
00064 gc_job_desc_t *
00065 gc_jd_stack_pop(gc_jd_stack_t *stack);
00066 
00067 __GC_END_DECLS
00068 
00069 
00070 #endif /* INCLUDED_GCELL_GC_JD_STACK_H */