Skip to content

Commit

Permalink
Merge branch 'zhangtao' into 'dev'
Browse files Browse the repository at this point in the history
fix thread bug

See merge request maix_sw/k230_canmv!219
  • Loading branch information
zzxcanaan committed Apr 25, 2024
2 parents ae7b417 + d2d211c commit f2d15cf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
8 changes: 3 additions & 5 deletions micropython_port/core/mpthreadport.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ STATIC sem_t thread_signal_done;
#endif

void mp_thread_unix_begin_atomic_section(void) {
pthread_mutex_lock(&thread_mutex);
while (pthread_mutex_lock(&thread_mutex) != 0);
}

void mp_thread_unix_end_atomic_section(void) {
Expand Down Expand Up @@ -305,10 +305,8 @@ void mp_thread_mutex_init(mp_thread_mutex_t *mutex) {
int mp_thread_mutex_lock(mp_thread_mutex_t *mutex, int wait) {
int ret;
if (wait) {
ret = pthread_mutex_lock(mutex);
if (ret == 0) {
return 1;
}
while (pthread_mutex_lock(mutex) != 0);
return 1;
} else {
ret = pthread_mutex_trylock(mutex);
if (ret == 0) {
Expand Down
3 changes: 0 additions & 3 deletions micropython_port/media/media.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from mpp import *
import _thread


MAX_MEDIA_BUFFER_POOLS = 16 #FIX VALUE
Expand Down Expand Up @@ -117,8 +116,6 @@ class media:
config_index = 0
__buf_has_init = False

lock = _thread.allocate_lock()

# create media link
@classmethod
def create_link(cls, souce, sink):
Expand Down

0 comments on commit f2d15cf

Please sign in to comment.