Commit Graph

61 Commits

Author SHA1 Message Date
Wildan M f15322453b Convert all println to log or todo 2026-01-25 05:27:38 +07:00
sourceturner defd2ce7c3 Deny deny-unsafe_op_in_unsafe_fn on the crate level 2026-01-21 00:41:57 +01:00
Wildan M 9789af36f0 Put timespec convert into common fn 2026-01-07 00:07:50 +07:00
Wildan M b063aadaa5 Release pthread cond workaround, simplify 2026-01-06 23:32:15 +07:00
Wildan M 10b5513e09 Fix other pthread tests 2026-01-06 16:12:50 +07:00
Wildan M 242ed32b42 Implement pthread_cond_timedwait futex properly 2026-01-06 15:33:58 +07:00
auronandace 6e25b2be7f arpa_inet and semaphore header cleanup 2025-12-31 09:14:21 +00:00
Anhad Singh 415d0f9edc fix(sync/futex_wait): handle EINTR
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2025-12-19 14:10:55 +11:00
Jeremy Soller 82084440ad Support nightly-2025-10-03 2025-10-03 21:51:10 -06:00
Jacob Lorentzon 9c5f11fbc8 Add Out<T> wrapper 2025-09-21 14:36:12 +02:00
Wildan M 80ea3bc6a1 Add sem_clockwait and fix timedwait clock_id 2025-08-28 12:58:54 +07:00
Anhad Singh 5eeb59dad2 feat(rand48): rwlock for global params
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-31 01:23:20 +11:00
Anhad Singh cfe89f828a feat: rwlock instead of mutex for global scope
* Rwlock -> InnerRwLock
* RwLock makes use of InnerRwLock.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-31 00:54:52 +11:00
Peter Limkilde Svendsen 06fec0b843 Add various basic docstrings 2024-10-27 23:25:57 +01:00
4lDO2 6e5959b3fa Convert a bunch of c_int to Result<(), Errno>. 2024-09-26 16:21:34 +02:00
4lDO2 4bd0d2a1ef Move pthread::Errno to separate module. 2024-09-11 23:22:29 +02:00
JustAnotherDev 7df5b16f9e set deny(unsafe_op_in_unsafe_fn) for 2024-09-11 20:55:05 +01:00
4lDO2 4c20a9abb2 Enable syscall restart in futex_wait. 2024-07-16 11:55:06 +02:00
Derick Eddington 802748b611 Fix Rwlock::acquire_write_lock to avoid blocking indefinitely.
Without this fix, `tests/bins_static/pthread/rwlock_randtest` would sometimes get stuck blocking
forever with only 1+ threads all doing `pthread_rwlock_wrlock()` but all the other threads
having finished.
2024-07-06 22:47:55 -07:00
4lDO2 6e86e64fdf Move pthread into TCB. 2024-06-08 11:36:22 +02:00
Jacob Lorentzon 1fba2ef10a Various futex fixes 2024-04-05 20:31:06 +00:00
4lDO2 e0a3811736 Protect fork() and clone() behind a rwlock.
rlct_clone will acquire a read lock, whereas fork will acquire a write
lock. The write lock is necessary because the fork will clone the file
table, which would result in other threads' fork/clone file descriptors
not being closed. If an address space switch fd never gets closed, fork
child processes and new threads, may never switch address spaces before
they are started, which has resulted in hard-to-debug RIP=0 instr fetch
page faults.
2024-03-27 10:30:49 +01:00
Jacob Lorentzon f7ac690c45 Fix pthread rwlock code 2024-03-26 15:46:32 +00:00
Jacob Lorentzon e0b640d530 Implement new low-level signal trampoline 2024-03-17 16:58:42 +00:00
Noa df6f4678e8 Fix warnings 2023-05-30 13:46:17 -05:00
4lDO2 cdd0f67b23 Rustfmt. 2023-05-17 15:28:10 +02:00
4lDO2 9040c2a2a2 fix semaphores 2023-05-11 17:18:12 -06:00
4lDO2 a7708a9fc8 Fix AtomicPtr::as_ptr compiler version problem. 2023-05-07 11:17:04 +02:00
4lDO2 439b054486 Rustify pthread_rwlock_t. 2023-05-06 17:02:54 +02:00
4lDO2 79dfddf82c Switch to a boring mutex+condvar based barrier.
While the atomic version might be better, at the moment the priority is
to just to get RLCT working reliably.
2023-05-06 17:02:53 +02:00
4lDO2 4e5596698d Hack to support multiple compiler versions. 2023-05-06 17:02:53 +02:00
4lDO2 a3e1eed100 Wake all when unlocking internal mutexes.
This is because we don't yet count the number of waiting threads,
instead just flagging where or not there are any waiters.
2023-05-06 17:02:53 +02:00
4lDO2 e6df6ccfb3 Fix once and try to improve barrier. 2023-05-06 17:02:53 +02:00
4lDO2 714e73112d Simplify Mutex implementation, for now. 2023-05-06 17:02:52 +02:00
4lDO2 beac24828d Use futex directly in waitval. 2023-05-06 17:02:52 +02:00
4lDO2 4faa315591 Use broadcast in Cond, for now. 2023-05-06 17:02:52 +02:00
4lDO2 1d989d5cb6 Improve barrier.
Maybe it would be better to simply stick to a mutex and condvar, as
libstd does. Optimization is for later anyway.
2023-05-06 17:02:52 +02:00
4lDO2 9356098fb2 WIP: More complete pthread mutex implementation. 2023-05-06 17:02:52 +02:00
4lDO2 38f89cb4bb Improved barrier implementation. 2023-05-06 17:02:51 +02:00
4lDO2 cf34e2512e Move condvar impl to a mostly-safe module. 2023-05-06 17:02:51 +02:00
4lDO2 22ffed707f Fix embarrasing deadlock! 2023-05-06 17:02:51 +02:00
4lDO2 b455e2e374 Misc improvements, move barrier to safe module. 2023-05-06 17:02:51 +02:00
4lDO2 b9f19f4326 Get pcid to work using this pthread impl. 2023-05-06 17:02:51 +02:00
4lDO2 6a658bc33d Add needed functions for acid to link. 2023-05-06 17:02:51 +02:00
4lDO2 2593101ea7 Get it to compile 2023-05-06 17:02:50 +02:00
4lDO2 558d43082c WIP: Expand native pthreads implementation. 2023-05-06 17:02:50 +02:00
Jeremy Soller 6516695519 Format 2022-12-16 17:39:30 -07:00
Jeremy Soller da4d277f12 Use futex again for semaphore 2022-12-01 14:05:12 -07:00
Jeremy Soller 9b04c2e5d3 Add missing imports 2022-12-01 10:50:27 -07:00
Jeremy Soller df75b8d037 Semaphore improvements 2022-12-01 10:48:53 -07:00