mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
Multithreaded locking fixes.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4692 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
0a878c4760
commit
d597536303
10 changed files with 447 additions and 237 deletions
|
@ -46,6 +46,22 @@ void mmap_unlock(void)
|
|||
pthread_mutex_unlock(&mmap_mutex);
|
||||
}
|
||||
}
|
||||
|
||||
/* Grab lock to make sure things are in a consistent state after fork(). */
|
||||
void mmap_fork_start(void)
|
||||
{
|
||||
if (mmap_lock_count)
|
||||
abort();
|
||||
pthread_mutex_lock(&mmap_mutex);
|
||||
}
|
||||
|
||||
void mmap_fork_end(int child)
|
||||
{
|
||||
if (child)
|
||||
pthread_mutex_init(&mmap_mutex, NULL);
|
||||
else
|
||||
pthread_mutex_unlock(&mmap_mutex);
|
||||
}
|
||||
#else
|
||||
/* We aren't threadsafe to start with, so no need to worry about locking. */
|
||||
void mmap_lock(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue