~statik/ubuntu/maverick/erlang/erlang-merge-testing

« back to all changes in this revision

Viewing changes to erts/emulator/beam/erl_bif_timer.c

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-05-01 10:14:38 UTC
  • mfrom: (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090501101438-6qlr6rsdxgyzrg2z
Tags: 1:13.b-dfsg-2
* Cleaned up patches: removed unneeded patch which helped to support
  different SCTP library versions, made sure that changes for m68k
  architecture applied only when building on this architecture.
* Removed duplicated information from binary packages descriptions.
* Don't require libsctp-dev build-dependency on solaris-i386 architecture
  which allows to build Erlang on Nexenta (thanks to Tim Spriggs for
  the suggestion).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* ``The contents of this file are subject to the Erlang Public License,
 
1
/*
 
2
 * %CopyrightBegin%
 
3
 * 
 
4
 * Copyright Ericsson AB 2005-2009. All Rights Reserved.
 
5
 * 
 
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/.
6
11
 * 
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.
11
16
 * 
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.''
15
 
 * 
16
 
 *     $Id$
 
17
 * %CopyrightEnd%
17
18
 */
18
19
 
19
20
#ifdef HAVE_CONFIG_H
314
315
#endif
315
316
    }
316
317
    else {
317
 
        ErtsProcLocks rp_locks = ERTS_PROC_LOCKS_MSG_SEND;
 
318
        ErtsProcLocks rp_locks = 0;
318
319
        Process* rp;
319
320
 
320
321
        tab_remove(btm);
322
323
        ASSERT(!erts_get_current_process());
323
324
 
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);
326
327
        else {
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);
332
 
                rp = NULL;
333
 
            }
334
331
        }
335
332
 
336
333
        if (rp) {
337
 
            if (!ERTS_PROC_PENDING_EXIT(rp)) {
338
 
                Eterm message;
339
 
                ErlHeapFragment *bp;
340
 
 
341
 
                bp = btm->bp;
342
 
                btm->bp = NULL; /* Prevent cleanup of message buffer... */
343
 
 
344
 
                if (!(btm->flags & BTM_FLG_WRAP))
345
 
                    message = btm->message;
346
 
                else {
 
334
            Eterm message;
 
335
            ErlHeapFragment *bp;
 
336
 
 
337
            bp = btm->bp;
 
338
            btm->bp = NULL; /* Prevent cleanup of message buffer... */
 
339
 
 
340
            if (!(btm->flags & BTM_FLG_WRAP))
 
341
                message = btm->message;
 
342
            else {
347
343
#if ERTS_REF_NUMBERS != 3
348
344
#error "ERTS_REF_NUMBERS changed. Update me..."
349
345
#endif
350
 
                    Eterm ref;
351
 
                    Uint *hp;
352
 
                    Uint wrap_size = REF_THING_SIZE + 4;
353
 
                    message = btm->message;
354
 
 
355
 
                    if (!bp) {
356
 
                        ErlOffHeap *ohp;
357
 
                        ASSERT(is_immed(message));
358
 
                        hp = erts_alloc_message_heap(wrap_size,
359
 
                                                     &bp,
360
 
                                                     &ohp,
361
 
                                                     rp,
362
 
                                                     &rp_locks);
363
 
                    } else {
364
 
                        Eterm old_size = bp->size;
365
 
                        bp = erts_resize_message_buffer(bp, old_size + wrap_size,
366
 
                                                        &message, 1);
367
 
                        hp = &bp->mem[0] + old_size;
368
 
                    }
369
 
 
370
 
                    write_ref_thing(hp,
371
 
                                    btm->ref_numbers[0],
372
 
                                    btm->ref_numbers[1],
373
 
                                    btm->ref_numbers[2]);
374
 
                    ref = make_internal_ref(hp);
375
 
                    hp += REF_THING_SIZE;
376
 
                    message = TUPLE3(hp, am_timeout, ref, message);
 
346
                Eterm ref;
 
347
                Uint *hp;
 
348
                Uint wrap_size = REF_THING_SIZE + 4;
 
349
                message = btm->message;
 
350
 
 
351
                if (!bp) {
 
352
                    ErlOffHeap *ohp;
 
353
                    ASSERT(is_immed(message));
 
354
                    hp = erts_alloc_message_heap(wrap_size,
 
355
                                                 &bp,
 
356
                                                 &ohp,
 
357
                                                 rp,
 
358
                                                 &rp_locks);
 
359
                } else {
 
360
                    Eterm old_size = bp->size;
 
361
                    bp = erts_resize_message_buffer(bp, old_size + wrap_size,
 
362
                                                    &message, 1);
 
363
                    hp = &bp->mem[0] + old_size;
377
364
                }
378
365
 
379
 
                erts_queue_message(rp, rp_locks, bp, message, NIL);
 
366
                write_ref_thing(hp,
 
367
                                btm->ref_numbers[0],
 
368
                                btm->ref_numbers[1],
 
369
                                btm->ref_numbers[2]);
 
370
                ref = make_internal_ref(hp);
 
371
                hp += REF_THING_SIZE;
 
372
                message = TUPLE3(hp, am_timeout, ref, message);
380
373
            }
 
374
 
 
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);
382
378
        }
383
379
    }
384
380