Commit Graph

90 Commits

Author SHA1 Message Date
PePerRoNii
c9064cf532 more concise null termination 2026-03-23 22:51:16 +07:00
WP. Yingamphol
019343bf00 Merge branch 'master' into master 2026-03-21 21:18:12 +07:00
Nathan Wong
bd9d682d15 Ensure creating a low priority thread does not assert with SCHED_OTHER policy 2026-01-13 16:38:22 -08:00
WP. Yingamphol
6e8bd908da Merge branch 'odin-lang:master' into master 2025-12-07 21:45:47 +07:00
Laytan Laats
71afb8e7a5 removes the darwin specific paths from thread_unix
I know I left a note there about deadlocks but it doesn't seem to happen
anymore, especially now that the test runner creates cancellation points.

Also, what was this `can_set_thread_cancel_state` for? It does not make
sense to me that it enables cancellation, and then does it again later.
With the comment it seems like it should be `.DISABLE` to first disable
and then wait for the thread to start. But even that seems weird, why
do you need to do that? I removed it.
2025-11-07 21:40:25 +01:00
WP. Yingamphol
704a917355 re-added Haiku os _set_name guard 2025-08-28 09:53:53 +07:00
PePerRoNii
e4cc58d992 thread.name = name in unix 2025-08-28 09:50:25 +07:00
WP. Yingamphol
155c03a2ee Merge branch 'odin-lang:master' into master 2025-08-20 20:18:22 +07:00
Laytan Laats
25389ed086 thread: set stack size to rlimit 2025-08-02 15:22:23 +02:00
PePerRoNii
2f770ff241 check for Haiku before calling _set_name 2025-07-22 11:18:45 +07:00
PePerRoNii
3c9d05a8c6 fix tid/handle bug on macos/win 2025-07-22 11:00:49 +07:00
PePerRoNii
a357113651 thread.create et al with name parameter 2025-07-22 10:52:29 +07:00
PePerRoNii
8f81b8761a changed [^]u8 to cstring for netbsd, added truncate_to_byte(name,0) on name return 2025-07-15 10:55:54 +07:00
WP. Yingamphol
805c3228b8 Update core/thread/thread_unix.odin
Co-authored-by: Laytan <laytanlaats@hotmail.com>
2025-07-15 09:32:02 +07:00
WP. Yingamphol
5ffba9b222 use copy proc group instead of copy_from_string
Co-authored-by: Laytan <laytanlaats@hotmail.com>
2025-07-15 09:30:49 +07:00
WP. Yingamphol
08c298808b spacing
Co-authored-by: Laytan <laytanlaats@hotmail.com>
2025-07-15 09:29:10 +07:00
PePerRoNii
8bc1ffd0df remove 'do' 2025-07-14 20:58:22 +07:00
PePerRoNii
7265782ddc remove unnecessary spaces, fix t -> thread, added more description 2025-07-14 20:39:52 +07:00
PePerRoNii
6f3cc31682 substitute sync.current_thread_id with posix.pthread_self for unix 2025-07-14 18:17:19 +07:00
PePerRoNii
b87b5431b1 substitute 'do' 2025-07-14 18:10:35 +07:00
PePerRoNii
0a3f73077e Get/Set Thread names 2025-07-14 17:23:36 +07:00
Jeroen van Rijn
1903d7211e Fix early join after start. 2025-06-21 11:47:00 +02:00
Jeroen van Rijn
5aa377e64e Revert changes to thread_unix.odin 2025-06-12 16:36:40 +02:00
Jeroen van Rijn
59ba37f232 Remove transmute 2025-06-12 16:05:34 +02:00
Jeroen van Rijn
994b5a2a6c Remove c import 2025-06-12 16:01:31 +02:00
Jeroen van Rijn
caf41aa046 Fix #5321 2025-06-12 16:00:24 +02:00
Laytan Laats
cc3c9bd871 fix thread_unix for Darwin after pthread corrections in posix package
afed3ce removed the sys/unix package and moved over to sys/posix, it has
new bindings for the pthread APIs but should have been equivalent (not).

8fb7182 used `CANCEL_ENABLE :: 0`, `CANCEL_DISABLE :: 1`, `CANCEL_DEFERRED :: 0`, `CANCEL_ASYNCHRONOUS :: 1` for Darwin, while the
correct values are `1`, `0`, `2` and `0` respectively (same mistake was made for
FreeBSD in that commit).

What this meant is that the
`pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS)` was not actually
successful, but because the error wasn't checked it was assumed it was.
It also meant `pthread_setcancelstate(PTHREAD_CANCEL_ENABLE)` would
actually be setting `PTHREAD_CANCEL_DISABLE`.

The code in this PR restores the behaviour by now actually deliberately
setting `PTHREAD_CANCEL_DISABLE` and not setting
`PTHREAD_CANCEL_ASYNCHRONOUS` which was the previous behaviour that does
actually seem to work for some reason.

(I also fixed an issue in fmt where `x` would use uppercase if it was a
pointer.)
2024-10-30 15:51:56 +01:00
Laytan
afed3ce6b5 remove pthread from sys/unix and use sys/posix where used 2024-10-28 19:20:43 +01:00
Karl Zylinski
093ade0504 Merge branch 'master' into file-tags-without-comments 2024-09-17 19:36:17 +02:00
Karl Zylinski
19f0127e55 Moved all packages in core, base, vendor, tests and examples to use new #+ file tag syntax. 2024-09-14 18:27:49 +02:00
Feoramund
4d14b4257e Convert POSIX Thread to use semaphore instead
One less value to store, and it should be less of a hack too.

Semaphores will not wait around if they have the go-ahead; they depend
on an internal value being non-zero, instead of whatever was loaded when
they started waiting, which is the case with a `Cond`.
2024-09-09 16:19:14 -04:00
Feoramund
74b28f1ff9 Fix rare double-join possibility in POSIX thread._join
This was occuring about 1/100 times with the test runner's thread pool.
2024-09-09 16:19:14 -04:00
Laytan Laats
1e6419b5b7 fix zombie thread leak in thread self cleanup 2024-08-28 16:22:38 +02:00
Feoramund
d338642dc4 Add API for freeing thread_local state 2024-08-26 06:01:59 -04:00
Laytan Laats
28fac62a02 fix some bugs with -disable-assert 2024-07-16 18:44:18 +02:00
Laytan Laats
604551eb2d wasi: make the demo run on wasi and run it in CI 2024-06-29 23:15:31 +02:00
Feoramund
0ea0fac2f9 Call pthread_cancel on Darwin, with advisory comment 2024-06-28 20:47:37 -04:00
Laytan Laats
00dfff7ee0 core/thread: fix a deadlock situation on unix 2024-06-07 20:28:09 +02:00
gingerBill
f9fd8f0c25 Merge pull request #3439 from andreas-jonsson/netbsd
NetBSD support
2024-05-15 10:33:52 +01:00
Feoramund
33c6f75a2e Fix joining non-Started threads from blocking main thread 2024-05-10 17:24:45 -04:00
Andreas T Jonsson
b72c2edabb Merge branch 'master' into netbsd 2024-05-10 09:04:52 +02:00
Feoramund
9cdb7b2584 Fix discrepancy with pthread cancelability state 2024-04-22 17:16:33 -04:00
Andreas T Jonsson
41d4dfbcd5 Fixed concurrency issue
Fixed broken thread policy causing deadlocks.
2024-04-18 16:20:49 +02:00
Andreas T Jonsson
38640d5d9e Updated core lib and did cleanup
Updated core with some path related functions and did some minor code cleanup.
Most of the standard library function is just a matter of copy what is there for the other BSDs.
2024-04-18 10:12:42 +02:00
Andreas T Jonsson
4558f3992a Initial commit of NetBSD port 2024-04-16 14:27:29 +02:00
avanspector
fca691a066 fix core:thread and a memory leak
in the future probably native non-pthread implementation for haiku will be required
2024-02-27 02:38:06 +01:00
gingerBill
3e7e779abf Replace core:* to base:* where appropriate 2024-01-28 22:18:51 +00:00
gingerBill
2cc22d118d Require parentheses for #align(N) 2023-08-15 14:55:02 +01:00
hikari
3b8515beb0 [core:thread] Seeing if this fixes network tests 2023-06-07 20:52:41 +03:00
hikari
7b62b81ebd [core:thread] Fix compilation 2023-06-07 20:03:19 +03:00