From 75946ba68708bf862ab8eeb03fa42b4eea230be6 Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Wed, 17 Jul 2013 22:14:33 -0400 Subject: [PATCH] doc: Add more TRYLOCK examples in ck_elide. --- doc/ck_elide | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/ck_elide b/doc/ck_elide index 57c6552..3fd66a9 100644 --- a/doc/ck_elide +++ b/doc/ck_elide @@ -163,10 +163,18 @@ function(void) CK_ELIDE_LOCK(ck_rwlock_write, &rw); CK_ELIDE_UNLOCK(ck_rwlock_write, &rw); + /* Attempt to acquire the write-side lock. */ + if (CK_ELIDE_TRYLOCK(ck_rwlock_write, &rw) == true) + CK_ELIDE_UNLOCK(ck_rwlock_write, &rw); + /* Lock-unlock read-side lock in weak best-effort manner. */ CK_ELIDE_LOCK(ck_rwlock_read, &rw); CK_ELIDE_UNLOCK(ck_rwlock_read, &rw); + /* Attempt to acquire the read-side lock. */ + if (CK_ELIDE_TRYLOCK(ck_rwlock_read, &rw) == true) + CK_ELIDE_UNLOCK(ck_rwlock_read, &rw); + /* Lock-unlock write-side lock in an adaptive manner. */ CK_ELIDE_LOCK_ADAPTIVE(ck_rwlock_write, &rw_stat, &rw_config, &rw);