Permalink
Browse files

make locking function compiler dependent

  • Loading branch information...
1 parent 22eae27 commit f94065b950c320572dc047932395c9f13ae241e0 @maysl committed Jan 22, 2013
Showing with 12 additions and 0 deletions.
  1. +6 −0 src/audiobuffer.c
  2. +6 −0 src/screenbuffer.c
View
6 src/audiobuffer.c
@@ -194,8 +194,14 @@ fische__audiobuffer_get (struct fische__audiobuffer* self)
void
fische__audiobuffer_lock (struct fische__audiobuffer* self)
{
+ #ifdef __GNUC__
while ( !__sync_bool_compare_and_swap( &self->priv->is_locked, 0, 1 ) )
usleep( 1 );
+ #else
+ while( self->priv->is_locked )
+ usleep( 1 );
+ self->priv->is_locked = 1;
+ #endif
}
void
View
6 src/screenbuffer.c
@@ -96,8 +96,14 @@ fische__screenbuffer_free (struct fische__screenbuffer* self)
void
fische__screenbuffer_lock (struct fische__screenbuffer* self)
{
+ #ifdef __GNUC__
while ( !__sync_bool_compare_and_swap( &self->priv->is_locked, 0, 1 ) )
usleep( 1 );
+ #else
+ while( self->priv->is_locked )
+ usleep( 1 );
+ self->priv->is_locked = 1;
+ #endif
}
void

0 comments on commit f94065b

Please sign in to comment.