update controller code

This commit is contained in:
Rongsong Shen 2025-11-05 16:58:57 +08:00
parent 2836d196da
commit 41f56fa6ed
54 changed files with 9688 additions and 214 deletions

View file

@ -171,41 +171,46 @@ int cbuf_get(cbuf_t* b,
return 0;
}
int my_rwlock_init(my_rwlock_t *l) {
if ( l == NULL) {
return -EINVAL;
int my_rwlock_init(my_rwlock_t* l)
{
if (l == NULL) {
return -EINVAL;
}
return pthread_rwlock_init(l, NULL);
}
void my_rwlock_fini(my_rwlock_t *l) {
void my_rwlock_fini(my_rwlock_t* l)
{
if (l == NULL) {
return;
return;
}
pthread_rwlock_destroy(l);
}
int my_rwlock_unlock(my_rwlock_t *l) {
if (l == NULL) {
return -EINVAL;
int my_rwlock_unlock(my_rwlock_t* l)
{
if (l == NULL) {
return -EINVAL;
}
return pthread_rwlock_unlock(l);
}
int my_rwlock_rlock(my_rwlock_t *l) {
int my_rwlock_rlock(my_rwlock_t* l)
{
if (l == NULL) {
return -EINVAL;
return -EINVAL;
}
return pthread_rwlock_rdlock(l);
}
int my_rwlock_wlock(my_rwlock_t *l) {
if (l==NULL) {
return -EINVAL;
int my_rwlock_wlock(my_rwlock_t* l)
{
if (l == NULL) {
return -EINVAL;
}
return pthread_rwlock_wrlock(l);