diff options
Diffstat (limited to 'erts/emulator/beam/erl_proc_sig_queue.h')
-rw-r--r-- | erts/emulator/beam/erl_proc_sig_queue.h | 147 |
1 files changed, 140 insertions, 7 deletions
diff --git a/erts/emulator/beam/erl_proc_sig_queue.h b/erts/emulator/beam/erl_proc_sig_queue.h index 2c2958fb39..bbff433711 100644 --- a/erts/emulator/beam/erl_proc_sig_queue.h +++ b/erts/emulator/beam/erl_proc_sig_queue.h @@ -30,6 +30,7 @@ * - Persistent monitor message * - Link * - Unlink + * - Unlink Ack * - Group leader * - Is process alive * - Process info request @@ -100,6 +101,12 @@ typedef struct { Eterm tag; } ErtsSignalCommon; +typedef struct { + ErtsSignalCommon common; + Eterm from; + Uint64 id; +} ErtsSigUnlinkOp; + #define ERTS_SIG_HANDLE_REDS_MAX_PREFERED (CONTEXT_REDS/40) #ifdef ERTS_PROC_SIG_HARD_DEBUG @@ -295,19 +302,97 @@ erts_proc_sig_send_link(Process *c_p, Eterm to, ErtsLink *lnk); /** * + * @brief Create a new unlink identifier + * + * The newly created unlink identifier is to be used in an + * unlink operation. + * + * @param[in] c_p Pointer to process struct of + * currently executing process. + * + * @return A new 64-bit unlink identifier + * unique in context of the + * calling process. The identifier + * may be any value but zero. + */ +ERTS_GLB_INLINE Uint64 erts_proc_sig_new_unlink_id(Process *c_p); + +/** + * + * @brief Create an unlink op signal structure + * + * The structure will contain a newly created unlink + * identifier to be used in the operation. + * + * @param[in] c_p Pointer to process struct of + * currently executing process + * ('from' is a process + * identifier), or NULL if not + * called in the context of an + * executing process ('from' is + * a port identifier). + * + * @param[in] from Id (as an erlang term) of + * entity sending the unlink + * signal. + * + * @return A pointer to the unlink op + * structure. + */ +ErtsSigUnlinkOp * +erts_proc_sig_make_unlink_op(Process *c_p, Eterm from); + +/** + * + * @brief Destroy an unlink op signal structure + * + * @param[in] sulnk A pointer to the unlink op + * structure. + */ +void +erts_proc_sig_destroy_unlink_op(ErtsSigUnlinkOp *sulnk); + +/** + * * @brief Send an unlink signal to a process. * * * @param[in] c_p Pointer to process struct of * currently executing process. * + * @param[in] from Id (as an erlang term) of + * entity sending the unlink + * signal. + * * @param[in] lnk Pointer to link structure from * the sending side. It should * contain information about * receiver. */ +Uint64 +erts_proc_sig_send_unlink(Process *c_p, Eterm from, ErtsLink *lnk); + +/** + * + * @brief Send an unlink acknowledgment signal to a process. + * + * + * @param[in] c_p Pointer to process struct of + * currently executing process. + * + * @param[in] from Id (as an erlang term) of + * entity sending the unlink + * signal. + * + * @param[in] sulnk A pointer to the unlink op + * structure. This structure + * was typically received by + * the caller in an unlink + * signal. + */ void -erts_proc_sig_send_unlink(Process *c_p, ErtsLink *lnk); +erts_proc_sig_send_unlink_ack(Process *c_p, Eterm from, + ErtsSigUnlinkOp *sulnk); /** * @@ -343,11 +428,35 @@ erts_proc_sig_send_dist_link_exit(struct dist_entry_ *dep, /** * - * @brief Send an unlink signal to a process. + * @brief Send an unlink signal to a local process. * * This function is used instead of erts_proc_sig_send_unlink() - * when the signal arrives via the distribution and - * therefore no link structure is available. + * when the signal arrives via the distribution. + * + * @param[in] dep Distribution entry of channel + * that the signal arrived on. + * + * @param[in] from Identifier of sender. + * + * @param[in] to Identifier of receiver. + * + * @param[in] id Identifier of unlink operation. + */ +void +erts_proc_sig_send_dist_unlink(DistEntry *dep, Uint32 conn_id, + Eterm from, Eterm to, Uint64 id); + +/** + * + * @brief Send an unlink acknowledgment signal to a local process. + * + * This function is used instead of erts_proc_sig_send_unlink_ack() + * when the signal arrives via the distribution. + * + * @param[in] c_p Pointer to process struct of + * currently executing process or + * NULL if not called in the context + * of an executing process. * * @param[in] dep Distribution entry of channel * that the signal arrived on. @@ -356,10 +465,12 @@ erts_proc_sig_send_dist_link_exit(struct dist_entry_ *dep, * * @param[in] to Identifier of receiver. * + * @param[in] id Identifier of unlink operation. */ void -erts_proc_sig_send_dist_unlink(struct dist_entry_ *dep, - Eterm from, Eterm to); +erts_proc_sig_send_dist_unlink_ack(Process *c_p, DistEntry *dep, + Uint32 conn_id, Eterm from, Eterm to, + Uint64 id); /** * @@ -706,6 +817,14 @@ erts_proc_sig_send_rpc_request(Process *c_p, Eterm (*func)(Process *, void *, int *, ErlHeapFragment **), void *arg); +int +erts_proc_sig_send_dist_spawn_reply(Eterm node, + Eterm ref, + Eterm to, + ErtsLink *lnk, + Eterm result, + Eterm token); + /* * End of send operations of currently supported process signals. */ @@ -787,7 +906,9 @@ erts_proc_sig_handle_incoming(Process *c_p, erts_aint32_t *statep, * queue. */ int -erts_proc_sig_handle_exit(Process *c_p, Sint *redsp); +erts_proc_sig_handle_exit(Process *c_p, Sint *redsp, + ErtsMonitor **pend_spawn_mon_pp, + Eterm reason); /** * @@ -1059,6 +1180,18 @@ Sint erts_proc_sig_fetch_msgq_len_offs__(Process *proc); #if ERTS_GLB_INLINE_INCL_FUNC_DEF +ERTS_GLB_INLINE Uint64 +erts_proc_sig_new_unlink_id(Process *c_p) +{ + Uint64 id; + ASSERT(c_p); + + id = (Uint64) c_p->uniq++; + if (id == 0) + id = (Uint64) c_p->uniq++; + return id; +} + ERTS_GLB_INLINE Sint erts_proc_sig_fetch(Process *proc) { |