Cameron Gutman
435bc6a5a4
Fix pthread_attr leak
2026-01-11 01:46:30 -06:00
Cameron Gutman
3a377e7d7b
Only set an explicit pthread stack size on Vita
2026-01-05 00:23:31 -06:00
Cameron Gutman
0586f3d65f
Fix thread context leak on non-Vita platforms
2026-01-05 00:21:35 -06:00
AorsiniYT
1c86405fd0
Fix: Add inclusion of <psp2/kernel/processmgr.h> for Vita compatibility
2025-11-07 00:37:14 -06:00
Andy Grundman
fdd026518c
macOS/iOS: use clock_gettime_nsec_np(CLOCK_UPTIME_RAW) instead of mach_absolute_time() per Apple's recommendation.
...
Move has_monotonic_time variable into the final variant of platform-specific time code (used by Linux/Unix).
2025-11-06 20:27:01 -06:00
Andy Grundman
82ee2d6590
Improve support for high-resolution stats
...
* This patch adds a new microsecond-resolution function call, LiGetMicroseconds(), to complement
the existing LiGetMillis(). Many variables used by stats have been updated to work at this
higher resolution and now provide better results when displaying e.g. sub-millisecond frametime stats.
To try and avoid confusion, variables that now contain microseconds have been renamed with a suffix
of 'Us', and those ending in 'Ms' contain milliseconds. I originally experimented with nanoseconds but it
felt like overkill for our needs.
Public API in Limelight.h:
uint64_t LiGetMicroseconds(void);
uint64_t LiGetMillis(void);
const RTP_AUDIO_STATS* LiGetRTPAudioStats(void); // provides access to RTP data for the overlay stats
const RTP_VIDEO_STATS* LiGetRTPVideoStats(void);
Note: Users of this library may need to make changes. If using LiGetMillis() to track the duration of
something that is shown to the user, consider switching to LiGetMicroseconds(). Remember to divide by
1000 at time of display to show in milliseconds.
2025-11-06 20:27:01 -06:00
armin-25689
29f298ec88
build: Add __FreeBSD__ compilation condition for pthread_setname_np()
2025-07-05 18:58:07 -05:00
AorsiniYT
34074c9ec0
Fixes for Moonlight compatibility on the PS Vita. ( #110 )
...
* Use pthread for vita thread managment
* Add thread name to pthread and remove ipv6 from vita
* Fix inclusion of pthread.h so that it is only included on specific platforms (__vita__)
* Fix memory release in ThreadProc for psvita platform
---------
Co-authored-by: MetalfaceScout <logan.mathis@utahtech.edu >
Co-authored-by: Logan Mathis <33127568+MetalfaceScout@users.noreply.github.com >
2025-07-05 18:57:33 -05:00
Cameron Gutman
8af4562af6
Assert that active objects exist in deleters
2024-02-17 18:20:24 -06:00
Cameron Gutman
59f7f62b62
Fix thread detachment on Vita
2024-02-17 18:14:49 -06:00
Cameron Gutman
9686f6942f
Consolidate PltCloseThread() and PltJoinThread()
2024-02-17 18:14:03 -06:00
GaryOderNichts
9545dd7603
Implement detached threads ( #88 )
...
The `AsyncTerm` thread is never joined but its handle is immediately closed. This works fine on Windows, but causes issues on other platforms where threads need to be explicitly detached if never joined (pthread, wiiu).
This adds a new `PltDetachThread` function, which can be used instead of `PltCloseThread` to explictly detach a thread, requiring it to no longer be closed.
2024-02-17 17:54:32 -06:00
zoeyjodon
35f730fedd
Improve 3DS Reliability ( #87 )
...
- Simplifies thread priority setup
- Sets a max socket buffer size of 0x20000 for the 3DS
- Fixes a bug with polling timeouts taking longer than intended
- Removes 3DS global socket definition
2024-02-02 18:33:18 -06:00
zoey jodon
c104a97fa0
Add platform support for the 3DS
...
Prevent wildcard port binding on the 3DS
Add 3DS threading logic
Add 3DS socket logic
Bump the connection timeout to 60s for the 3DS
2024-01-18 18:30:20 -06:00
Cameron Gutman
8b84d17c8d
Replace additional unsafe string functions
2023-10-06 17:33:37 -05:00
Cameron Gutman
b282c7e603
Ensure UNIX implementations of PltGetMillis() are not limited to 32 bits
2022-10-22 14:45:19 -05:00
Cameron Gutman
6d767a8494
Assume the platform supports clock_gettime() if CLOCK_MONOTONIC is defined
2022-10-22 14:45:19 -05:00
Cameron Gutman
71a267fd28
Change PltWaitForEvent to void return type
2021-06-09 19:37:06 -05:00
Cameron Gutman
61b4fc1fe7
Add condition variable support and reimplement PLT_EVENT with it for non-Win32 platforms
2021-06-09 19:29:31 -05:00
Cameron Gutman
ccec4e8475
Add thread naming on macOS and iOS
2021-06-09 03:00:25 -05:00
GaryOderNichts
e5b39af6a5
some Wii U changes
2021-06-05 01:59:58 +02:00
GaryOderNichts
0c66a50e2d
Wii U platform support
2021-06-04 21:36:54 +02:00
Cameron Gutman
46cea5011d
Use GetModuleHandle() for kernel32.dll, since it's guaranteed to be loaded already
2021-05-25 19:40:14 -05:00
Cameron Gutman
daee5db7bc
Use SleepEx() instead of WaitForSingleObjectEx() to implement PltSleepMs()
...
This was legacy cruft from back when Sleep() was forbidden in Metro apps in Win8.0.
2021-05-16 11:41:38 -05:00
Cameron Gutman
ed9301f3f8
Join the input thread without interrupting first
...
Otherwise we'll kill it before it finishes draining
2021-05-15 22:56:44 -05:00
Cameron Gutman
bc1b5a1b2f
Fix Linux build
2021-04-29 17:40:13 -05:00
Cameron Gutman
8f371343cd
Consolidate includes
2021-04-29 17:22:15 -05:00
Cameron Gutman
ae92f15b0a
Use SRW locks for our mutex on Windows
...
These avoid a kernel transition for uncontended cases
2021-04-25 15:04:12 -05:00
Cameron Gutman
5f9f7ce407
Code cleanup: use stdbool.h
2020-11-30 20:38:13 -06:00
Cameron Gutman
9e4651e460
Fix implicit function declaration warnings
2020-08-29 21:13:54 -07:00
Cameron Gutman
5ddd53e17f
Enable media streaming mode for 802.11 WLAN interfaces on Windows
2020-08-11 22:12:58 -07:00
Cameron Gutman
1154cb1d3d
Name our threads on Windows
2019-05-03 20:55:20 -07:00
Cameron Gutman
31aa893acd
Name our threads on Linux
2019-05-03 18:54:40 -07:00
Cameron Gutman
d6971983aa
Use an interruptible sleep to allow our threads to exit sooner
2019-04-06 15:26:59 -07:00
Cameron Gutman
c9745855fd
Track leaks of mutexes and events for debugging
2019-03-17 12:56:27 -07:00
Cameron Gutman
487a62f58c
Fix MSVC build issues
2018-09-25 00:56:43 -07:00
Cameron Gutman
dd7820f100
Add LiGetMillis() for clients to use for latency calculation
2018-09-25 00:47:22 -07:00
Cameron Gutman
454fdccffc
Fix possible lost wakeups by acquring event mutex in signal path
2017-08-20 00:28:15 -07:00
Cameron Gutman
e3dadc3c08
Fix a couple files with bogus permissions
2017-08-20 00:28:15 -07:00
Cameron Gutman
af6f13c7fa
Use clock_gettime() for better timestamps on platforms that support it
2017-06-10 12:07:25 -07:00
Sunguk Lee
5ab67fb864
vita: Increate thread stack size
...
readsolomon require large stack memory for the [decode][1]
lazy calucation: 0x105f9
- dataDecodeMatrix: 255 * 255
- subShards: 255 * 4
- outputs: 255 * 4
Fixes #27
[1]: https://github.com/moonlight-stream/moonlight-common-c/blob/9bf8d36/reedsolomon/rs.c#L500-L502
2017-05-05 18:53:16 +09:00
Sunguk Lee
ba27e97698
Add vita environment ( #22 )
...
* vita: initial port
* vita: implement events, enable input thread
* vita: gethostbyname
* vita: Enable audio
* vita: Fix thread crash on discoonect process
* vita: Handle cannot create thread
* vita: now use newlib's socket apis
* vita: Refactoring for moonlight-stream/moonlight-common-c
* Fix review things
https://github.com/moonlight-stream/moonlight-common-c/pull/22#pullrequestreview-2436093
- vita may not support IPv6; so add LC_ASSERT them.
- define inet_ntop to sceNetInetNtop
- guard about failure of sceKernelCreateMutex or sceKernelCreateCond
- remove meanless macros
https://github.com/moonlight-stream/moonlight-common-c/pull/22#pullrequestreview-2444677
- !*mutex to *mutex
- remove useless LC_ASSERT then change to use inet_ntop
in vita system not defined `sockaddr_in6`, so just use `sockaddr_in` instead this.
https://github.com/moonlight-stream/moonlight-common-c/pull/22#pullrequestreview-2445642
- define sin6_addr
2016-10-05 16:43:33 -07:00
Cameron Gutman
48a5d63045
Reorganize the folder structure and delete the Xcode build files
2016-03-31 07:22:03 -04:00