user_mutex: Per-team contexts.

This requires the introduction of the flag B_USER_MUTEX_SHARED, and then
actually using the SHARED flags in pthread structures to determine when
it should be passed through.

This commit still uses wired memory even for per-team contexts.
That will change in the next commit.

GLTeapot FPS seems about the same.

Change-Id: I749a00dcea1531e113a65299b6d6610f57511fcc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6602
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
Augustin Cavalier
2023-06-19 14:56:10 +00:00
committed by waddlesplash
parent 0ab9f280ec
commit 93d7d1c52c
10 changed files with 193 additions and 71 deletions
+2
View File
@@ -65,6 +65,7 @@ struct realtime_sem_context; // defined in realtime_sem.cpp
struct select_info;
struct user_thread; // defined in libroot/user_thread.h
struct VMAddressSpace;
struct user_mutex_context; // defined in user_mutex.cpp
struct xsi_sem_context; // defined in xsi_semaphore.cpp
namespace Scheduler {
@@ -240,6 +241,7 @@ struct Team : TeamThreadIteratorEntry<team_id>, KernelReferenceable,
int state; // current team state, see above
int32 flags;
struct io_context *io_context;
struct user_mutex_context *user_mutex_context;
struct realtime_sem_context *realtime_sem_context;
struct xsi_sem_context *xsi_sem_context;
struct team_death_entry *death_entry; // protected by fLock
+5 -2
View File
@@ -13,13 +13,16 @@
extern "C" {
#endif
struct user_mutex_context;
void user_mutex_init();
void delete_user_mutex_context(struct user_mutex_context* context);
status_t _user_mutex_lock(int32* mutex, const char* name, uint32 flags,
bigtime_t timeout);
status_t _user_mutex_unblock(int32* mutex, uint32 flags);
status_t _user_mutex_switch_lock(int32* fromMutex, int32* toMutex,
const char* name, uint32 flags, bigtime_t timeout);
status_t _user_mutex_switch_lock(int32* fromMutex, uint32 fromFlags,
int32* toMutex, const char* name, uint32 toFlags, bigtime_t timeout);
status_t _user_mutex_sem_acquire(int32* sem, const char* name, uint32 flags,
bigtime_t timeout);
status_t _user_mutex_sem_release(int32* sem);