posixc.library: refactor __exec_do to make clear separation between regular path...
[AROS.git] / rom / disk / giveunit.c
blob01f9fd432fab617abc745ae843c6ee93909225be
1 /*
2 Copyright © 2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: GiveUnit() function.
6 Lang: english
7 */
9 #include <proto/disk.h>
10 #include <proto/exec.h>
11 #include <resources/disk.h>
13 AROS_LH0(void, GiveUnit,
14 struct DiscResource *, DiskBase, 4, Disk)
16 AROS_LIBFUNC_INIT
18 struct Task *thistask = FindTask(0);
19 struct DiscResourceUnit *dru;
21 Disable();
22 if (DiskBase->dr_CurrTask == thistask) {
23 DiskBase->dr_CurrTask = NULL;
24 DiskBase->dr_Flags &= ~DRF_ACTIVE;
25 dru = (struct DiscResourceUnit*)RemHead(&DiskBase->dr_Waiting);
26 Enable();
27 if (dru)
28 ReplyMsg(&dru->dru_Message);
29 } else {
30 Enable ();
33 AROS_LIBFUNC_EXIT