Re: [Qemu-devel] [PATCH 2/2] atomic-test: Add spinlock test case

2015-05-11 Thread Alexander Spyridakis
Hi Andrew, On 11 May 2015 at 12:17, Andrew Jones wrote: > > + > > +void atomic_lock(int *lock_var) > > +{ > > +while (__sync_lock_test_and_set(lock_var, 1)); > > +} > > + > > +void atomic_unlock(int *lock_var) > > +{ > > +__sync_lock_release(lock_var); > > +} > > Do these builtins actuall

Re: [Qemu-devel] [PATCH 2/2] atomic-test: Add spinlock test case

2015-05-11 Thread Andrew Jones
On Thu, May 07, 2015 at 01:31:42PM +0200, Alexander Spyridakis wrote: > Sample spinlock test case with the option to implement the spinlock > by means of GCC atomic instructions or unsafe memory operations. > Additionally, printf is wrapped around a spinlock to avoid concurrent > access to the seri

[Qemu-devel] [PATCH 2/2] atomic-test: Add spinlock test case

2015-05-07 Thread Alexander Spyridakis
Sample spinlock test case with the option to implement the spinlock by means of GCC atomic instructions or unsafe memory operations. Additionally, printf is wrapped around a spinlock to avoid concurrent access to the serial device. Suggested-by: Jani Kokkonen Suggested-by: Claudio Fontana Signed