revert between 56095 -> 55830 in arch
[AROS.git] / workbench / demos / notify.c
blobf809ee82b74b209d8a7f1ea80449a6caffa44ad3
1 /*
2 Copyright © 2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Test program for ram.handler notification.
6 */
8 #include <proto/exec.h>
9 #include <exec/memory.h>
10 #include <stdio.h>
11 #include <dos/dos.h>
12 #include <dos/dosextens.h>
13 #include <dos/notify.h>
14 #include <proto/exec.h>
15 #include <proto/dos.h>
17 #include <stdlib.h>
20 int main(int argc, char* argv[])
22 printf("Program waits till a file with the name 'Olle' is"
23 "created in RAM:\n");
25 struct NotifyRequest *nr = AllocVec(sizeof(struct NotifyRequest),
26 MEMF_CLEAR);
27 BPTR lock;
29 if (nr == NULL)
31 printf("Could not allocate memory.\n");
32 exit(1);
35 nr->nr_Name = "Olle";
36 nr->nr_Flags = NRF_SEND_SIGNAL;
37 nr->nr_stuff.nr_Signal.nr_Task = FindTask(NULL);
38 nr->nr_stuff.nr_Signal.nr_SignalNum = SIGB_SINGLE;
40 lock = Lock("Ram Disk:", SHARED_LOCK);
42 if (lock == BNULL)
44 printf("Could not lock Ram Disk:\n");
45 exit(1);
48 CurrentDir(lock);
50 StartNotify(nr);
52 printf("Waiting for notification\n");
54 Wait(SIGF_SINGLE);
56 printf("Got notification!\n");
58 return 0;