/* file: mycthreads.h */ /* author: MLehr */ /* * Copyright (C) 1994 * by the Rector and Board of Visitors of * the University of Virginia * * for more information: * Sanghyuk Son * Department of Computer Science * School of Engineering and Applied Science * University of Virginia * Charlottesville, VA 22903 */ #ifndef MYCTHREADS_H_ #define MYCTHREADS_H_ 1 /* We need to be able to use lightweight locks, but the C-thread headers in mach3/src/mk/user/threads/ produce many compile-time errors, so we put together our own. */ typedef volatile int spin_lock_t; #define spin_lock_init(s) (*(s) = 0) #define spin_lock(p) if (!spin_try_lock (p)) spin_lock_solid (p); /* If you use these functions, link with the C-threads library, libthreads.a. */ void spin_lock_solid (spin_lock_t *); void spin_unlock (spin_lock_t *); int spin_try_lock (spin_lock_t *); #endif /* MYCTHREADS_H_ */