Page MenuHomeFreeBSD

virtual_oss: Clean up pthread on exit
AbandonedPublic

Authored by christos on May 23 2025, 5:15 PM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 17 2025, 8:19 AM
Unknown Object (File)
Nov 17 2025, 5:24 AM
Unknown Object (File)
Nov 17 2025, 4:23 AM
Unknown Object (File)
Nov 17 2025, 2:18 AM
Unknown Object (File)
Nov 16 2025, 9:54 PM
Unknown Object (File)
Nov 12 2025, 9:57 AM
Unknown Object (File)
Nov 12 2025, 6:05 AM
Unknown Object (File)
Nov 12 2025, 6:05 AM
Subscribers
None

Details

Summary

To do that we also need to cache the thread pointers so that we can use
them later in destroy_threads(). Also add error checking on pthread
functions whose return values we care about.

Sponsored by: The FreeBSD Foundation

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

markj added inline comments.
virtual_main.c
2680

I don't see much benefit to explicitly freeing memory right before the process exits.

This revision is now accepted and ready to land.May 25 2025, 6:09 PM
virtual_main.c
2680

I'm aware the OS will clean up resources anyway, but isn't it better to make sure we clean up on our part?

virtual_main.c
2680

The only reason it might be better to clean up is to future-proof it, in case this code is copied into a library for instance. But in that case the change is incomplete, since presumably we'd need to clean up in the error cases as well.

christos marked 2 inline comments as done.

Remove atomic_destroy().

This revision now requires review to proceed.May 28 2025, 3:30 PM