Comments (8)
Did you read the actual code and go through the "rabbit hole" or do you just "think" it should be "better" this way?
More precisely, did you read this line?
https://github.com/airspy/airspyone_host/blob/master/libairspy/src/airspy.c#L832
from airspyone_host.
Did you read the actual code and go through the "rabbit hole" or do you just "think" it should be "better" this way? More precisely, did you read this line?
https://github.com/airspy/airspyone_host/blob/master/libairspy/src/airspy.c#L832
Realized the wording "uninitialized" is wrong on my side. I should have expressed it as "calling ptherad_jonin() with a thread id of zero causes segfault".
from airspyone_host.
I am yet to see a segfault with that code. pthread_join returns ESRCH with thread_id 0, which is perfectly fine.
from airspyone_host.
The following program segfaults on CentOS 6, CentOS 7 and Fedora 39 but works on Raspberry Pi OS (Bookworm and Buster). So not all pthread implementations on all platforms handles a thread id of 0 to pthread_join()
as ESRCH.
#include <pthread.h>
int main(int argc, char **argv) {
pthread_t thread = 0;
pthread_join(thread, NULL);
return 0;
}
Compiled with:
$ gcc -o out segfault.c -lpthread
from airspyone_host.
Can't reproduce on any up to date Linux on any CPU I tested (x86, x86_64, ARMHF, AARCH64.) Maybe you just highlighted a problem in your distro? I'm sure you can find more broken Linux stuff if you bring a distro from the 90s.
Yet, the "fix" you proposed still doesn't work because of the many possible ways libusb can fail. Someone has to go through that rabbit hole and do the actual investigation work. Maybe a simple check can work for the fossilized distros. Or maybe we should exclude them to keep a sane code base.
Try it: https://onlinegdb.com/VQarzj8G-
from airspyone_host.
The reference to the old CentOS distros was just to show that the behavior of pthread_join()
has been consistent for a very long time in the RHEL-line of distros. Fedora 39 is a recent distro and the issue I'm raising is not about fossilized distros.
As far as I can read, passing anything other than a joinable thread id as the first argument to pthread_join()
is undefined behavior. Distros/implementations have apparently made different choices how to handle this (Debian/Ubuntu: return ESRCH, RHEL-line: segfault) . Nothing odd about that but code using pthread should be written with this in mind. In this case not calling pthread_join()
with a invalid/NULL thread id or a thread id that was previously joined.
I'll create a PR with a check.
from airspyone_host.
This should be it.
from airspyone_host.
Tnx.
from airspyone_host.
Related Issues (20)
- compilation HOT 1
- 10MHz Bandwidth AirSpy Mini HOT 1
- airspy_close() blocks for ever if disconnect from USB unconditionally HOT 1
- Is this program support Airspy HF+?
- Compilation issue in Windows 10 with MSVC/CMake HOT 2
- missing license for the repo HOT 1
- Airspy GR-Windows support HOT 1
- Inconsistent line endings in airspy.c HOT 1
- Deadlock in airspy_close if device is unplugged while streaming HOT 11
- libusb transfers not properly cleaned up if device is unplugged while streaming HOT 1
- Ship the udev rules upstream HOT 5
- position of dropped_samples in stream HOT 12
- use clang14.0.5 build opencv,but “always_inline function '_mm_shuffle_epi8' requires target feature 'ssse3', but would be inlined into function 'ExtractAlpha_SSE41' that is compiled without support for 'ssse3'” HOT 1
- BUG: Adding users to group `plugdev` HOT 1
- build fails on Raspberry Pi (debian buster) because of libusb_wrap_sys_device() API not supported HOT 5
- libairspy is slow when receiving float32 iq on Apple M1 HOT 6
- TR setup on Raspberry Pi not creating or saving audio files to shortName Dir HOT 1
- airspy_rx could use ppm correction option (fixed with new tool airspy_calibrate) HOT 7
- Receive callback stops being called HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from airspyone_host.