|
From: Jeremy F. <je...@go...> - 2005-01-19 22:55:05
|
CVS commit by fitzhardinge:
Previous change to fix bug 97407 was not really correct. This is better.
M +2 -1 vg_scheduler.c 1.215
M +4 -0 linux/core_os.h 1.4
M +7 -4 linux/sema.c 1.3
--- valgrind/coregrind/vg_scheduler.c #1.214:1.215
@@ -606,5 +606,6 @@ static void sched_fork_cleanup(ThreadId
}
- /* re-init the sema */
+ /* re-init and take the sema */
+ VG_(sema_deinit)(&run_sema);
VG_(sema_init)(&run_sema);
VG_(sema_down)(&run_sema);
--- valgrind/coregrind/linux/sema.c #1.2:1.3
@@ -58,8 +58,4 @@ void VG_(sema_init)(vg_sema_t *sema)
void VG_(sema_init)(vg_sema_t *sema)
{
- if (sema->pipe[0] >= VG_(fd_hard_limit)) {
- VG_(close)(sema->pipe[0]);
- VG_(close)(sema->pipe[1]);
- }
VG_(pipe)(sema->pipe);
sema->pipe[0] = VG_(safe_fd)(sema->pipe[0]);
@@ -72,4 +68,11 @@ void VG_(sema_init)(vg_sema_t *sema)
}
+void VG_(sema_deinit)(vg_sema_t *sema)
+{
+ VG_(close)(sema->pipe[0]);
+ VG_(close)(sema->pipe[1]);
+ sema->pipe[0] = sema->pipe[1] = -1;
+}
+
/* get a token */
void VG_(sema_down)(vg_sema_t *sema)
--- valgrind/coregrind/linux/core_os.h #1.3:1.4
@@ -100,4 +100,7 @@ extern Int __futex_up_slow(vg_sema_t *);
void VG_(sema_init)(vg_sema_t *);
+static inline void VG_(sema_deinit)(vg_sema_t *)
+{
+}
static inline void VG_(sema_down)(vg_sema_t *futx)
@@ -141,4 +144,5 @@ typedef struct {
void VG_(sema_init)(vg_sema_t *);
+void VG_(sema_deinit)(vg_sema_t *);
void VG_(sema_down)(vg_sema_t *sema);
void VG_(sema_up)(vg_sema_t *sema);
|