Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

make locking function compiler dependent

  • Loading branch information...
commit f94065b950c320572dc047932395c9f13ae241e0 1 parent 22eae27
Marcel Ebmer authored
Showing with 12 additions and 0 deletions.
  1. +6 −0 src/audiobuffer.c
  2. +6 −0 src/screenbuffer.c
6 src/audiobuffer.c
View
@@ -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
6 src/screenbuffer.c
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.