Meziu
90bd4d00e3
Merge pull request #12 from Meziu/fix/avoid-svcGetThreadList-pthread-attr-default
...
Avoid using svcGetThreadList when getting default pthread attr
3 years ago
AzureMarker
acb2736f67
Avoid using svcGetThreadList when getting default pthread attr
...
This simplifies the code anyway.
3 years ago
Meziu
187d2ae5db
Merge pull request #11 from Meziu/tweak/processor-naming
...
Rename "ideal_processor" to "processor_id"
3 years ago
AzureMarker
9dbe184b1f
Rename "ideal_processor" to "processor_id"
3 years ago
Meziu
0e4aa32e5f
Merge pull request #10 from Meziu/feature/pthread-threads
...
More changes for pthread threading support
3 years ago
AzureMarker
88d12c91ad
Implement pthread_getprocessorid_np
3 years ago
AzureMarker
cac16d639c
Replace pthread_getpriority with more standard version (and add set fn)
...
In the case of the main thread we use a hack since there's no nice API
for getting the main thread's handle (see code).
3 years ago
AzureMarker
d1815bcb9b
Add pthread_self and improve thread function error handling
3 years ago
AzureMarker
717938f682
Rename affinity to "ideal processor"
...
This follows the 3dbrew.org wiki naming.
Also added a get version.
3 years ago
AzureMarker
ba5c5d787e
Change to more standard priority function interfaces
3 years ago
AzureMarker
27a5601020
Change estimated error code when thread spawning fails
3 years ago
Meziu
b3498da8a7
Merge pull request #9 from Meziu/feature/pthread-threads
...
Add back threading support and implement extensions
3 years ago
AzureMarker
1704505614
Deallocate the closure if thread spawning failed
3 years ago
AzureMarker
db26a42401
Implement pthread extensions and improve pthread_create
...
pthread_create wasn't actually calling the entrypoint it was given,
which was incorrect. It also didn't handle errors.
3 years ago
Meziu
9fb7872855
Merge pull request #8 from ian-h-chamberlain/pthread_sigmask
...
Add stub pthread_sigmask implementation
3 years ago
Ian Chamberlain
5d36aefb44
Add stub pthread_sigmask implementation
3 years ago
AzureMarker
c82ce62c9b
Add back basic pthread threading support
...
Had to fix a few compile errors since we switched to using ctru_sys
directly. This is also just the basic support that was there before.
More work needs to be done to support std.
3 years ago
Andrea Ciliberti
87eceaf5ef
Use ctru-sys rather than re-declarations
3 years ago
Meziu
67bb74bc52
Merge pull request #6 from AzureMarker/fix/tokio
...
Fix some bugs breaking Tokio
3 years ago
AzureMarker
a7ff3bc394
Fix pthread_cond_timedwait from sleeping for about 52 years
...
pthread_cond_timedwait gives a timestamp as the timeout, but libctru
expects a duration. After converting the timestamp to nanoseconds since
epoch, we were telling libctru to sleep for over 52 years!
This commit changes our impl to convert the timestamp to a duration.
Additionally, CondVar_WaitTimeout returns a boolean indicating if it
timed out or not. But pthread_cond_timedwait expects a libc-style error
code. This conversion is added as well.
3 years ago
AzureMarker
fdd1b58452
Fix reentrant locking behavior in thread keys
...
The standard library RwLock checks if it's panicking while making the
guard. This check needs to use a thread local key, which it lazily
creates. This causes reentrant/recursive locking, which leads to a
deadlock.
This commit replaces the std RwLock with one from spin, which does not
need to check thread local storage to lock. It's a spin-lock, but it is
configured to yield the thread on every unsuccessful spin. Also, the
lock can be created statically, which means we don't need once_cell.
An alternative to spin is parking_lot, but that has some compile errors
(it wants condvars to support monotonic clocks) and brings in more
dependencies.
3 years ago
Meziu
4100f80b32
Merge pull request #5 from AzureMarker/fix/pthread-keys
...
Make thread keys impl thread-safe and handle invalid keys
3 years ago
AzureMarker
89cfb145b7
Make thread keys impl thread-safe and handle invalid keys
...
We still don't actually run the destructors... Which could be fine, but
we should probably run them somewhere.
I have a feeling we might also need to look at this though:
https://github.com/devkitPro/libctru/blob/master/libctru/source/internal.h
3 years ago
Meziu
39d601003d
Merge pull request #4 from AzureMarker/update/libc
3 years ago
AzureMarker
68ce6ec089
Update libc to the upstream
...
Our PR merged.
3 years ago
Andrea Ciliberti
207b108914
Removed thread spawn support in favor of ctru threads
3 years ago
Andrea Ciliberti
cea081ac27
Guess it works now
3 years ago
Andrea Ciliberti
69eb0774f8
Testing rwlock impl
3 years ago
Meziu
878b8a30af
Merge pull request #2 from AzureMarker/master
...
Add an init method to force linking
3 years ago
AzureMarker
04a89ae72c
Add init method to force linking
3 years ago
AzureMarker
098027869a
Remove staticlib crate type to simplify Cargo.toml
...
We can just use the default (lib). Also standardized the dependency
specification.
3 years ago
Andrea Ciliberti
67e1c79fd6
Merge branch 'master' of https://github.com/Meziu/pthread-3ds
3 years ago
Andrea Ciliberti
98a8b638af
Fixed warnings from clippy and formatted
3 years ago
Meziu
c8af3ed28e
Merge pull request #1 from AzureMarker/master
3 years ago
AzureMarker
53b6948559
Use Git dependency instead of path
...
This makes using the crate much easier.
3 years ago
Meziu
74acb03a72
Working state
3 years ago