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:
committed by
waddlesplash
parent
0ab9f280ec
commit
93d7d1c52c
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
#define THREAD_CANCEL_ENABLED 0x08
|
||||
#define THREAD_CANCEL_ASYNCHRONOUS 0x10
|
||||
|
||||
// _pthread_mutex::flags values
|
||||
#define MUTEX_FLAG_SHARED 0x80000000
|
||||
|
||||
|
||||
struct thread_creation_attributes;
|
||||
|
||||
|
||||
@@ -78,8 +78,9 @@ extern ssize_t _kern_wait_for_objects(object_wait_info* infos, int numInfos,
|
||||
extern status_t _kern_mutex_lock(int32* mutex, const char* name,
|
||||
uint32 flags, bigtime_t timeout);
|
||||
extern status_t _kern_mutex_unblock(int32* mutex, uint32 flags);
|
||||
extern status_t _kern_mutex_switch_lock(int32* fromMutex, int32* toMutex,
|
||||
const char* name, uint32 flags, bigtime_t timeout);
|
||||
extern status_t _kern_mutex_switch_lock(int32* fromMutex, uint32 fromFlags,
|
||||
int32* toMutex, const char* name, uint32 toflags,
|
||||
bigtime_t timeout);
|
||||
extern status_t _kern_mutex_sem_acquire(int32* sem, const char* name,
|
||||
uint32 flags, bigtime_t timeout);
|
||||
extern status_t _kern_mutex_sem_release(int32* sem);
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
#define _SYSTEM_USER_MUTEX_DEFS_H
|
||||
|
||||
|
||||
// user mutex specific flags passed to _kern_mutex_unblock()
|
||||
// flags passed to _kern_mutex_{un}block
|
||||
#define B_USER_MUTEX_SHARED 0x40000000
|
||||
// Mutex is in shared memory.
|
||||
#define B_USER_MUTEX_UNBLOCK_ALL 0x80000000
|
||||
// All threads currently waiting on the mutex will be unblocked. The mutex
|
||||
// state will be locked.
|
||||
|
||||
Reference in New Issue
Block a user