2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
7 #include <proto/exec.h>
8 #include <dos/dostags.h>
10 #include <proto/utility.h>
12 #include "camd_intern.h"
15 struct DriverData
*driverdatatemp
=NULL
;
17 SAVEDS
void ReceiverFunc(void){
19 struct DriverData
*driverdata
=driverdatatemp
;
21 driverdata
->ReceiverSig
=AllocSignal(-1);
22 if(driverdata
->ReceiverSig
==-1){
23 driverdata
->isReceiverProcessAlive
=2;
27 driverdata
->isReceiverProcessAlive
=1;
31 1L<<driverdata
->ReceiverSig
|
35 if(sig
&1L<<driverdata
->ReceiverSig
){
36 while(driverdata
->unpicked
>0){
37 Receiver_first(driverdata
);
40 if(sig
&SIGBREAKF_CTRL_C
) break;
43 FreeSignal(driverdata
->ReceiverSig
);
45 driverdata
->isReceiverProcessAlive
=0;
50 /* CL_Linkages must be locked first (exclusive). */
52 BOOL
CreateReceiverProc(
53 struct DriverData
*driverdata
,
57 struct CamdBase
*CamdBase
59 struct Process
*process
;
62 name
=AllocVec(mystrlen(inname
)+70,MEMF_ANY
| MEMF_PUBLIC
);
70 mysprintf(CamdBase
,name
,"CAMD ReceiverProc %s %ld",inname
,portnum
);
73 driverdatatemp
=driverdata
;
75 driverdata
->isReceiverProcessAlive
=0;
77 process
=CreateNewProcTags(
78 NP_Entry
, (IPTR
) ReceiverFunc
,
91 while(driverdata
->isReceiverProcessAlive
== 0){
95 if(driverdata
->isReceiverProcessAlive
==2){
96 driverdata
->isReceiverProcessAlive
=0;
98 *ErrorCode
=CME_NoSignals
;
104 driverdata
->ReceiverProc
=process
;
105 driverdata
->ReceiverProcName
=name
;
110 /* CL_Linkages must be locked first. */
112 void EndReceiverProc(
113 struct DriverData
*driverdata
,
114 struct CamdBase
*CamdBase
116 Signal((struct Task
*)driverdata
->ReceiverProc
,SIGBREAKF_CTRL_C
);
117 while(driverdata
->isReceiverProcessAlive
==1) Delay(1);
118 FreeVec(driverdata
->ReceiverProcName
);