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 |
> |
if (nproc > 1) |
32 |
> |
error(WARNING, "Only single process supported"); |
33 |
> |
ray_pdone(0); |
34 |
> |
ray_init(otnm); |
35 |
> |
ray_popen(nproc); |
36 |
|
} |
37 |
|
|
38 |
|
|
41 |
|
RAY *r |
42 |
|
) |
43 |
|
{ |
44 |
< |
error(CONSISTENCY, "parallel ray processing unimplemented"); |
44 |
> |
if (r == NULL) |
45 |
> |
return; |
46 |
> |
if (ray_pnidle <= 0) |
47 |
> |
error(INTERNAL, "illegal call to ray_psend"); |
48 |
> |
queued_ray = *r; |
49 |
> |
ray_pnidle = 0; |
50 |
|
} |
51 |
|
|
52 |
|
|
55 |
|
RAY *r |
56 |
|
) |
57 |
|
{ |
58 |
< |
return(0); |
58 |
> |
if (r == NULL) |
59 |
> |
return(0); |
60 |
> |
ray_value(r); |
61 |
> |
return(1); |
62 |
|
} |
63 |
|
|
64 |
|
|
68 |
|
int poll |
69 |
|
) |
70 |
|
{ |
71 |
< |
return(-1); |
71 |
> |
if (r == NULL) |
72 |
> |
return(0); |
73 |
> |
if (!poll & (ray_pnidle <= 0)) { |
74 |
> |
ray_value(&queued_ray); |
75 |
> |
*r = queued_ray; |
76 |
> |
ray_pnidle = 1; |
77 |
> |
return(1); |
78 |
> |
} |
79 |
> |
return(0); |
80 |
|
} |
81 |
|
|
82 |
|
|
85 |
|
int freall |
86 |
|
) |
87 |
|
{ |
88 |
+ |
ray_done(freall); |
89 |
+ |
ray_pnprocs = ray_pnidle = 0; |
90 |
|
} |
91 |
|
|
92 |
|
|
95 |
|
int nadd |
96 |
|
) |
97 |
|
{ |
98 |
< |
error(CONSISTENCY, "parallel ray processing unimplemented"); |
98 |
> |
if (ray_pnprocs + nadd > 1) { |
99 |
> |
error(WARNING, "Only single process supported"); |
100 |
> |
nadd = 1 - ray_pnprocs; |
101 |
> |
} |
102 |
> |
ray_pnprocs += nadd; |
103 |
> |
ray_pnidle += nadd; |
104 |
|
} |
105 |
|
|
106 |
|
|
109 |
|
int nsub |
110 |
|
) |
111 |
|
{ |
112 |
+ |
if (nsub > ray_pnprocs) |
113 |
+ |
nsub = ray_pnprocs; |
114 |
+ |
ray_pnprocs -= nsub; |
115 |
+ |
if ((ray_pnidle -= nsub) < 0) |
116 |
+ |
ray_pnidle = 0; |
117 |
|
} |
118 |
|
|
119 |
|
|