atomic.h

Go to the documentation of this file.
00001 /** @file rutz/atomic.h Atomic integers (e.g. for threadsafe reference counting) */
00002 
00003 ///////////////////////////////////////////////////////////////////////
00004 //
00005 // Copyright (c) 2006-2007 University of Southern California
00006 // Rob Peters <rjpeters at usc dot edu>
00007 //
00008 // created: Thu Aug 10 16:56:03 2006
00009 // commit: $Id: atomic.h 8249 2007-04-12 06:03:40Z rjpeters $
00010 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/rutz/atomic.h $
00011 //
00012 // --------------------------------------------------------------------
00013 //
00014 // This file is part of GroovX.
00015 //   [http://www.klab.caltech.edu/rjpeters/groovx/]
00016 //
00017 // GroovX is free software; you can redistribute it and/or modify it
00018 // under the terms of the GNU General Public License as published by
00019 // the Free Software Foundation; either version 2 of the License, or
00020 // (at your option) any later version.
00021 //
00022 // GroovX is distributed in the hope that it will be useful, but
00023 // WITHOUT ANY WARRANTY; without even the implied warranty of
00024 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00025 // General Public License for more details.
00026 //
00027 // You should have received a copy of the GNU General Public License
00028 // along with GroovX; if not, write to the Free Software Foundation,
00029 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00030 //
00031 ///////////////////////////////////////////////////////////////////////
00032 
00033 #ifndef GROOVX_RUTZ_ATOMIC_H_UTC20070412044324_DEFINED
00034 #define GROOVX_RUTZ_ATOMIC_H_UTC20070412044324_DEFINED
00035 
00036 // For now we only have inline assembly for atomic integer operations
00037 // for ix86 cpus; would be nice to eventually have analogous
00038 // operations for ppc.
00039 #if defined(INVT_CPU_IX86)
00040 #  include "rutz/atomic_ix86.h"
00041 namespace rutz { typedef ix86_atomic_int atomic_int_t; }
00042 
00043 #elif defined(HAVE_LIBKERN_OSATOMIC_H)
00044 #  include "rutz/atomic_darwin.h"
00045 namespace rutz { typedef darwin_atomic_int atomic_int_t; }
00046 
00047 #else
00048 #  include "rutz/atomic_mutex.h"
00049 namespace rutz { typedef mutex_atomic_int atomic_int_t; }
00050 #endif
00051 
00052 // ######################################################################
00053 /* So things look consistent in everyone's emacs... */
00054 /* Local Variables: */
00055 /* mode: c++ */
00056 /* indent-tabs-mode: nil */
00057 /* End: */
00058 
00059 static const char __attribute__((used)) vcid_groovx_rutz_atomic_h_utc20070412044324[] = "$Id: atomic.h 8249 2007-04-12 06:03:40Z rjpeters $ $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/rutz/atomic.h $";
00060 #endif // !GROOVX_RUTZ_ATOMIC_H_UTC20070412044324DEFINED
Generated on Sun May 8 08:42:09 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3