This is an automated email from the ASF dual-hosted git repository.
chenBright pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git
The following commit(s) were added to refs/heads/master by this push:
new f101f13c fix(bthread): drop unimplemented barrier and rwlockattr APIs
(#3504)
f101f13c is described below
commit f101f13c00a0b6f03d5ce892f7a512458f94b004
Author: darion-yaphet <[email protected]>
AuthorDate: Tue Sep 1 00:10:17 2026 +0800
fix(bthread): drop unimplemented barrier and rwlockattr APIs (#3504)
* fix(bthread): drop unimplemented barrier and rwlockattr APIs
These declarations had no definitions, so calling them failed at
link time. Keep bthread_rwlockattr_t for bthread_rwlock_init().
* fix(bthread): keep unimplemented APIs as commented TODOs
Leave barrier and rwlockattr declarations in comments so they can
be restored later, instead of deleting them.
---
src/bthread/bthread.h | 25 +++++++++++++------------
src/bthread/types.h | 15 +++++++++------
2 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/src/bthread/bthread.h b/src/bthread/bthread.h
index 008beffa..e0d95892 100644
--- a/src/bthread/bthread.h
+++ b/src/bthread/bthread.h
@@ -249,6 +249,7 @@ extern int bthread_cond_timedwait(
// Initialize read-write lock `rwlock' using attributes `attr', or use
// the default values if later is nullptr.
+// NOTE: attr is not used in the current implementation.
extern int bthread_rwlock_init(bthread_rwlock_t* __restrict rwlock,
const bthread_rwlockattr_t* __restrict attr);
@@ -281,20 +282,20 @@ extern int bthread_rwlock_unlock(bthread_rwlock_t*
rwlock);
// ---------------------------------------------------
// Functions for handling read-write lock attributes.
// ---------------------------------------------------
+// TODO: Implement these APIs. bthread_rwlock_init() currently ignores attr.
// Initialize attribute object `attr' with default values.
-extern int bthread_rwlockattr_init(bthread_rwlockattr_t* attr);
+// extern int bthread_rwlockattr_init(bthread_rwlockattr_t* attr);
// Destroy attribute object `attr'.
-extern int bthread_rwlockattr_destroy(bthread_rwlockattr_t* attr);
+// extern int bthread_rwlockattr_destroy(bthread_rwlockattr_t* attr);
// Return current setting of reader/writer preference.
-extern int bthread_rwlockattr_getkind_np(const bthread_rwlockattr_t* attr,
- int* pref);
+// extern int bthread_rwlockattr_getkind_np(const bthread_rwlockattr_t* attr,
+// int* pref);
// Set reader/write preference.
-extern int bthread_rwlockattr_setkind_np(bthread_rwlockattr_t* attr,
- int pref);
+// extern int bthread_rwlockattr_setkind_np(bthread_rwlockattr_t* attr, int
pref);
// -------------------------------------------
// Functions for handling semaphore.
@@ -343,18 +344,18 @@ extern int bthread_sem_post(bthread_sem_t* sem);
// Return 0 on success, errno otherwise.
extern int bthread_sem_post_n(bthread_sem_t* sem, size_t n);
-
// ----------------------------------------------------------------------
// Functions for handling barrier which is a new feature in 1003.1j-2000.
// ----------------------------------------------------------------------
+// TODO: Implement bthread barrier.
-extern int bthread_barrier_init(bthread_barrier_t* __restrict barrier,
- const bthread_barrierattr_t* __restrict attr,
- unsigned count);
+// extern int bthread_barrier_init(bthread_barrier_t* __restrict barrier,
+// const bthread_barrierattr_t* __restrict
attr,
+// unsigned count);
-extern int bthread_barrier_destroy(bthread_barrier_t* barrier);
+// extern int bthread_barrier_destroy(bthread_barrier_t* barrier);
-extern int bthread_barrier_wait(bthread_barrier_t* barrier);
+// extern int bthread_barrier_wait(bthread_barrier_t* barrier);
// ---------------------------------------------------------------------
// Functions for handling thread-specific data.
diff --git a/src/bthread/types.h b/src/bthread/types.h
index 1fb7a5d0..14411e5e 100644
--- a/src/bthread/types.h
+++ b/src/bthread/types.h
@@ -247,15 +247,18 @@ typedef struct bthread_rwlock_t {
unsigned* lock_word;
} bthread_rwlock_t;
+// Kept for ABI compatibility with bthread_rwlock_init(). Pass nullptr
+// for the default. See TODO on bthread_rwlockattr_* in bthread.h.
typedef struct {
} bthread_rwlockattr_t;
-typedef struct {
- unsigned int count;
-} bthread_barrier_t;
-
-typedef struct {
-} bthread_barrierattr_t;
+// TODO: Implement bthread barrier.
+// typedef struct {
+// unsigned int count;
+// } bthread_barrier_t;
+//
+// typedef struct {
+// } bthread_barrierattr_t;
#if defined(__cplusplus)
class bthread_once_t;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]