diff options
author | pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-06-07 20:50:51 +0000 |
---|---|---|
committer | pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-06-07 20:50:51 +0000 |
commit | d597536303d762c4209cbab7e379819b8eb14536 (patch) | |
tree | 3330934421d15c1d5d1f95e18fe9bc36da7cc6cd /linux-user/mmap.c | |
parent | 0a878c4760718e1604e2cfe423252729716110ad (diff) | |
download | qemu-d597536303d762c4209cbab7e379819b8eb14536.zip qemu-d597536303d762c4209cbab7e379819b8eb14536.tar.gz qemu-d597536303d762c4209cbab7e379819b8eb14536.tar.bz2 |
Multithreaded locking fixes.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4692 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'linux-user/mmap.c')
-rw-r--r-- | linux-user/mmap.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/linux-user/mmap.c b/linux-user/mmap.c index c082138..b4ca107 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -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) |