aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2012-08-28 20:49:04 +0200
committerSverker Eriksson <[email protected]>2012-08-28 20:49:04 +0200
commit6d71b902d0ae8eb85b59af4905c234f05228cf97 (patch)
treeefd66264c4df608f78fbe7ef33fb8defab9f457c
parent8fcbcbb97e4cff45f90cf1a10a3e9dca99f76f47 (diff)
downloadotp-6d71b902d0ae8eb85b59af4905c234f05228cf97.tar.gz
otp-6d71b902d0ae8eb85b59af4905c234f05228cf97.tar.bz2
otp-6d71b902d0ae8eb85b59af4905c234f05228cf97.zip
Fix premature deallocation bug of port data lock
Release port data lock *after* "async_ready" or "free" callback has been called.
-rw-r--r--erts/emulator/beam/erl_async.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/erts/emulator/beam/erl_async.c b/erts/emulator/beam/erl_async.c
index cb975d64b0..f308039baf 100644
--- a/erts/emulator/beam/erl_async.c
+++ b/erts/emulator/beam/erl_async.c
@@ -394,6 +394,8 @@ static ERTS_INLINE void call_async_ready(ErtsAsync *a)
}
erts_port_release(p);
}
+ if (a->pdl)
+ driver_pdl_dec_refc(a->pdl);
if (a->hndl)
erts_ddll_dereference_driver(a->hndl);
}
@@ -403,9 +405,6 @@ static ERTS_INLINE void async_reply(ErtsAsync *a, ErtsThrQPrepEnQ_t *prep_enq)
#if ERTS_USE_ASYNC_READY_Q
ErtsAsyncReadyQ *arq;
- if (a->pdl)
- driver_pdl_dec_refc(a->pdl);
-
#if ERTS_ASYNC_PRINT_JOB
erts_fprintf(stderr, "=>> %ld\n", a->async_id);
#endif
@@ -425,8 +424,6 @@ static ERTS_INLINE void async_reply(ErtsAsync *a, ErtsThrQPrepEnQ_t *prep_enq)
#else /* ERTS_USE_ASYNC_READY_Q */
call_async_ready(a);
- if (a->pdl)
- driver_pdl_dec_refc(a->pdl);
erts_free(ERTS_ALC_T_ASYNC, (void *) a);
#endif /* ERTS_USE_ASYNC_READY_Q */