Clear the argument array before passing it to ReadArgs(). No more junk
[AROS.git] / rom / graphics / ownblitter.c
blob47e64a61c147698b5f60f83b091d317f2f0decca
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Try to own the blitter for private usage
6 Lang: english
7 */
9 #include <aros/debug.h>
11 #include <proto/exec.h>
12 #include <graphics/gfxbase.h>
13 #include <exec/execbase.h>
14 #include <exec/tasks.h>
16 #include "graphics_intern.h"
17 #include "gfxfuncsupport.h"
19 /*****************************************************************************
21 NAME */
22 #include <proto/graphics.h>
24 AROS_LH0(void, OwnBlitter,
26 /* SYNOPSIS */
29 /* LOCATION */
30 struct GfxBase *, GfxBase, 76, Graphics)
32 /* FUNCTION
33 The blitter is allocated for exclusive use by the calling task.
34 This function returns immediately if no other task is using
35 the blitter right now or if no blits are in the queues (QBlit(),
36 QBSBlit()). Otherwise the function will block until the blitter
37 can be accessed.
38 It is good practice to start the blitter immediately after calling
39 this function and then call DisownBlitter() so other tasks can
40 use the blitter.
42 INPUTS
44 RESULT
46 NOTES
48 EXAMPLE
50 BUGS
52 SEE ALSO
53 DisownBlitter()
55 INTERNALS
57 HISTORY
59 ******************************************************************************/
61 AROS_LIBFUNC_INIT
63 struct BlitWaitQNode node;
64 struct Task *me;
66 me = FindTask(NULL);
68 D(bug("OwnBlitter: Request by Task %p)\n", me));
70 Disable();
71 for (;;) {
72 if (GfxBase->BlitOwner == NULL) {
73 GfxBase->BlitOwner = me;
74 Enable();
75 D(bug("OwnBlitter: Now owned by Task %p\n", me));
76 return;
78 node.task = me;
79 AddTail(&GfxBase->BlitWaitQ, (struct Node*)&node);
80 SetSignal(0, 1 << SIGB_BLIT);
81 Wait(1 << SIGB_BLIT);
82 Remove((struct Node*)&node);
85 AROS_LIBFUNC_EXIT
86 } /* OwnBlitter */