13 |
|
* See raypcalls.c for an explanation of these routines. |
14 |
|
*/ |
15 |
|
|
16 |
< |
/***** XXX CURRENTLY, THIS IS JUST A COLLECTION OF FATAL STUBS XXX *****/ |
16 |
> |
/***** XXX CURRENTLY, THIS IS JUST A COLLECTION OF IMPOTENT STUBS XXX *****/ |
17 |
|
|
18 |
|
#include "ray.h" |
19 |
|
|
20 |
+ |
int ray_pnprocs = 0; /* number of child processes */ |
21 |
+ |
int ray_pnidle = 0; /* number of idle children */ |
22 |
|
|
23 |
+ |
static RAY queued_ray; |
24 |
+ |
|
25 |
|
extern void |
26 |
|
ray_pinit( /* initialize ray-tracing processes */ |
27 |
|
char *otnm, |
28 |
|
int nproc |
29 |
|
) |
30 |
|
{ |
31 |
< |
error(CONSISTENCY, "parallel ray processing unimplemented"); |
31 |
> |
ray_pdone(0); |
32 |
> |
ray_init(otnm); |
33 |
> |
ray_popen(nproc); |
34 |
|
} |
35 |
|
|
36 |
|
|
39 |
|
RAY *r |
40 |
|
) |
41 |
|
{ |
42 |
< |
error(CONSISTENCY, "parallel ray processing unimplemented"); |
42 |
> |
if (r == NULL) |
43 |
> |
return; |
44 |
> |
if (ray_pnidle <= 0) |
45 |
> |
error(INTERNAL, "illegal call to ray_psend"); |
46 |
> |
queued_ray = *r; |
47 |
> |
ray_pnidle = 0; |
48 |
|
} |
49 |
|
|
50 |
|
|
53 |
|
RAY *r |
54 |
|
) |
55 |
|
{ |
56 |
< |
return(0); |
56 |
> |
if (r == NULL) |
57 |
> |
return(0); |
58 |
> |
ray_value(r); |
59 |
> |
return(1); |
60 |
|
} |
61 |
|
|
62 |
|
|
66 |
|
int poll |
67 |
|
) |
68 |
|
{ |
69 |
< |
return(-1); |
69 |
> |
if (r == NULL) |
70 |
> |
return(0); |
71 |
> |
if (ray_pnidle <= 0) { |
72 |
> |
ray_value(&queued_ray); |
73 |
> |
*r = queued_ray; |
74 |
> |
ray_pnidle = 1; |
75 |
> |
return(1); |
76 |
> |
} |
77 |
> |
return(0); |
78 |
|
} |
79 |
|
|
80 |
|
|
83 |
|
int freall |
84 |
|
) |
85 |
|
{ |
86 |
+ |
ray_done(freall); |
87 |
+ |
ray_pnprocs = ray_pnidle = 0; |
88 |
|
} |
89 |
|
|
90 |
|
|
93 |
|
int nadd |
94 |
|
) |
95 |
|
{ |
96 |
< |
error(CONSISTENCY, "parallel ray processing unimplemented"); |
96 |
> |
if (ray_pnprocs + nadd > 1) { |
97 |
> |
error(WARNING, "Only single process supported"); |
98 |
> |
nadd = 1 - ray_pnprocs; |
99 |
> |
} |
100 |
> |
ray_pnprocs += nadd; |
101 |
> |
ray_pnidle += nadd; |
102 |
|
} |
103 |
|
|
104 |
|
|
107 |
|
int nsub |
108 |
|
) |
109 |
|
{ |
110 |
+ |
if (nsub > ray_pnprocs) |
111 |
+ |
nsub = ray_pnprocs; |
112 |
+ |
ray_pnprocs -= nsub; |
113 |
+ |
if ((ray_pnidle -= nsub) < 0) |
114 |
+ |
ray_pnidle = 0; |
115 |
|
} |
116 |
|
|
117 |
|
|