Commit 38f1900b authored by Kirill Smelkov's avatar Kirill Smelkov

libgolang/thread: Don't ignore PyThread_acquire_lock return

With WAIT_LOCK flag and correct usage PyThread_acquire_lock should never
fail, but let's be cautious and verify that it indeed succeeds to acquire
the lock.

The rest of external functions called by thread runtime either have void
return, or their return is checked.
parent 48785942
...@@ -112,7 +112,9 @@ cdef nogil: ...@@ -112,7 +112,9 @@ cdef nogil:
void sema_acquire(_libgolang_sema *gsema): void sema_acquire(_libgolang_sema *gsema):
pysema = <PyThread_type_lock>gsema pysema = <PyThread_type_lock>gsema
PyThread_acquire_lock(pysema, WAIT_LOCK) ok = PyThread_acquire_lock(pysema, WAIT_LOCK)
if ok == 0:
panic("pyxgo: thread: sema_acquire: PyThread_acquire_lock failed")
void sema_release(_libgolang_sema *gsema): void sema_release(_libgolang_sema *gsema):
pysema = <PyThread_type_lock>gsema pysema = <PyThread_type_lock>gsema
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment