Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / realtime / deleteplayer.c
blob4da097bcaadb6cd1708b43a78af8c2157094093b
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
8 #include <proto/exec.h>
9 #include <proto/utility.h>
10 #include <proto/realtime.h>
12 #include "realtime_intern.h"
14 /*****************************************************************************
16 NAME */
18 #include <libraries/realtime.h>
20 AROS_LH1(VOID, DeletePlayer,
22 /* SYNOPSIS */
24 AROS_LHA(struct Player *, player, A0),
26 /* LOCATION */
28 struct Library *, RealTimeBase, 8, RealTime)
30 /* FUNCTION
32 Delete a player. If this was the last player of a specific conductor,
33 this conductor is deleted too.
35 INPUTS
37 player -- Player to delete; may be NULL in which case this function
38 does nothing.
40 RESULT
42 NOTES
44 EXAMPLE
46 BUGS
48 SEE ALSO
50 CreatePlayerA()
52 INTERNALS
54 HISTORY
56 26.7.99 SDuvan implemented
58 ******************************************************************************/
61 AROS_LIBFUNC_INIT
63 struct Conductor *conductor;
65 if (player == NULL)
67 return;
70 conductor = player->pl_Source;
72 if (conductor != NULL)
74 APTR lock;
76 lock = LockRealTime(RT_CONDUCTORS);
77 Remove((struct Node *)player);
79 /* If this was the last player of this conductor, we delete the
80 conductor, too. */
81 if (IsListEmpty(&conductor->cdt_Players))
83 Remove((struct Node *)conductor);
84 FreeMem(conductor, sizeof(struct Conductor));
87 UnlockRealTime(lock);
90 FreeMem(player, sizeof(struct Player));
92 AROS_LIBFUNC_EXIT
93 } /* DeletePlayer */