2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
5 Desc: Add a port to the public list of ports.
9 #include <exec/ports.h>
10 #include <proto/exec.h>
12 #include "exec_intern.h"
13 #include "exec_debug.h"
15 /*****************************************************************************
19 AROS_LH1(void, AddPort
,
22 AROS_LHA(struct MsgPort
*, port
, A1
),
25 struct ExecBase
*, SysBase
, 59, Exec
)
28 Add a port to the public port list. The ln_Name and ln_Pri fields
29 must be initialized prior to calling this function, while
30 the port itself is reinitialized before adding. Therefore it's
31 not allowed to add an active port.
34 port - Pointer to messageport structure.
48 ******************************************************************************/
51 ASSERT_VALID_PTR(port
);
53 /* Arbitrate for the list of messageports. */
56 /* Yes, this is a messageport */
57 port
->mp_Node
.ln_Type
=NT_MSGPORT
;
59 /* Clear the list of messages */
60 #if defined(__AROSEXEC_SMP__)
61 EXEC_SPINLOCK_INIT(&port
->mp_SpinLock
);
63 NEWLIST(&port
->mp_MsgList
);
64 #if defined(__AROSEXEC_SMP__)
65 EXEC_SPINLOCK_LOCK(&PrivExecBase(SysBase
)->PortListSpinLock
, NULL
, SPINLOCK_MODE_WRITE
);
67 /* And add the actual port */
68 Enqueue(&SysBase
->PortList
,&port
->mp_Node
);
69 #if defined(__AROSEXEC_SMP__)
70 EXEC_SPINLOCK_UNLOCK(&PrivExecBase(SysBase
)->PortListSpinLock
);