1
/* ``The contents of this file are subject to the Erlang Public License,
4
* Copyright Ericsson AB 2005-2009. All Rights Reserved.
6
* The contents of this file are subject to the Erlang Public License,
2
7
* Version 1.1, (the "License"); you may not use this file except in
3
8
* compliance with the License. You should have received a copy of the
4
9
* Erlang Public License along with this software. If not, it can be
5
* retrieved via the world wide web at http://www.erlang.org/.
10
* retrieved online at http://www.erlang.org/.
7
12
* Software distributed under the License is distributed on an "AS IS"
8
13
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
9
14
* the License for the specific language governing rights and limitations
10
15
* under the License.
12
* The Initial Developer of the Original Code is Ericsson Utvecklings AB.
13
* Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
14
* AB. All Rights Reserved.''
19
20
#ifdef HAVE_CONFIG_H
322
323
ASSERT(!erts_get_current_process());
324
325
if (btm->flags & BTM_FLG_BYNAME)
325
rp = erts_whereis_process(NULL,0,btm->receiver.name,rp_locks,0);
326
rp = erts_whereis_process(NULL,0,btm->receiver.name,0,ERTS_P2P_FLG_SMP_INC_REFC);
327
328
rp = btm->receiver.proc.ess;
328
erts_smp_proc_lock(rp, rp_locks);
329
erts_smp_proc_inc_refc(rp);
329
330
unlink_proc(btm);
330
if (ERTS_PROC_IS_EXITING(rp)) {
331
erts_smp_proc_unlock(rp, rp_locks);
337
if (!ERTS_PROC_PENDING_EXIT(rp)) {
342
btm->bp = NULL; /* Prevent cleanup of message buffer... */
344
if (!(btm->flags & BTM_FLG_WRAP))
345
message = btm->message;
338
btm->bp = NULL; /* Prevent cleanup of message buffer... */
340
if (!(btm->flags & BTM_FLG_WRAP))
341
message = btm->message;
347
343
#if ERTS_REF_NUMBERS != 3
348
344
#error "ERTS_REF_NUMBERS changed. Update me..."
352
Uint wrap_size = REF_THING_SIZE + 4;
353
message = btm->message;
357
ASSERT(is_immed(message));
358
hp = erts_alloc_message_heap(wrap_size,
364
Eterm old_size = bp->size;
365
bp = erts_resize_message_buffer(bp, old_size + wrap_size,
367
hp = &bp->mem[0] + old_size;
373
btm->ref_numbers[2]);
374
ref = make_internal_ref(hp);
375
hp += REF_THING_SIZE;
376
message = TUPLE3(hp, am_timeout, ref, message);
348
Uint wrap_size = REF_THING_SIZE + 4;
349
message = btm->message;
353
ASSERT(is_immed(message));
354
hp = erts_alloc_message_heap(wrap_size,
360
Eterm old_size = bp->size;
361
bp = erts_resize_message_buffer(bp, old_size + wrap_size,
363
hp = &bp->mem[0] + old_size;
379
erts_queue_message(rp, rp_locks, bp, message, NIL);
369
btm->ref_numbers[2]);
370
ref = make_internal_ref(hp);
371
hp += REF_THING_SIZE;
372
message = TUPLE3(hp, am_timeout, ref, message);
375
erts_queue_message(rp, &rp_locks, bp, message, NIL);
381
376
erts_smp_proc_unlock(rp, rp_locks);
377
erts_smp_proc_dec_refc(rp);