tools/genmodule: Fix error in tests/clib/execl; should also fix gcc
[AROS.git] / rom / graphics / ownblitter.c
blob5009170ac13dea97c3bea6642f1a0813dfb4759c
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 #define DEBUG 0
10 #include <aros/debug.h>
12 #include <proto/exec.h>
13 #include <graphics/gfxbase.h>
14 #include <exec/execbase.h>
15 #include <exec/tasks.h>
17 #include "graphics_intern.h"
18 #include "gfxfuncsupport.h"
20 /*****************************************************************************
22 NAME */
23 #include <proto/graphics.h>
25 AROS_LH0(void, OwnBlitter,
27 /* SYNOPSIS */
30 /* LOCATION */
31 struct GfxBase *, GfxBase, 76, Graphics)
33 /* FUNCTION
34 The blitter is allocated for exclusive use by the calling task.
35 This function returns immediately if no other task is using
36 the blitter right now or if no blits are in the queues (QBlit(),
37 QBSBlit()). Otherwise the function will block until the blitter
38 can be accessed.
39 It is good practice to start the blitter immediately after calling
40 this function and then call DisownBlitter() so other tasks can
41 use the blitter.
43 INPUTS
45 RESULT
47 NOTES
49 EXAMPLE
51 BUGS
53 SEE ALSO
54 DisownBlitter()
56 INTERNALS
58 HISTORY
60 ******************************************************************************/
62 AROS_LIBFUNC_INIT
64 struct BlitWaitQNode node;
65 struct Task *me;
67 me = FindTask(NULL);
69 D(bug("OwnBlitter: Request by Task %p)\n", me));
71 Disable();
72 for (;;) {
73 if (GfxBase->BlitOwner == NULL) {
74 GfxBase->BlitOwner = me;
75 Enable();
76 D(bug("OwnBlitter: Now owned by Task %p\n", me));
77 return;
79 node.task = me;
80 AddTail(&GfxBase->BlitWaitQ, (struct Node*)&node);
81 SetSignal(0, 1 << SIGB_BLIT);
82 Wait(1 << SIGB_BLIT);
83 Remove((struct Node*)&node);
86 AROS_LIBFUNC_EXIT
87 } /* OwnBlitter */