23 |
|
#include "pmapdiag.h" |
24 |
|
#include "rcontrib.h" |
25 |
|
#include "otypes.h" |
26 |
+ |
#include "otspecial.h" |
27 |
|
#if NIX |
28 |
|
#include <sys/mman.h> |
29 |
|
#include <sys/wait.h> |
197 |
|
if (!nsources) |
198 |
|
error(USER, "no light sources in distribPhotonContrib"); |
199 |
|
|
199 |
– |
if (nsources > MAXMODLIST) |
200 |
– |
error(USER, "too many light sources in distribPhotonContrib"); |
201 |
– |
|
200 |
|
/* Allocate photon flux per light source; this differs for every |
201 |
|
* source as all sources contribute the same number of distributed |
202 |
|
* photons (srcDistribTarget), hence the number of photons emitted per |
390 |
|
} |
391 |
|
#endif |
392 |
|
|
393 |
< |
#if PMAP_SIGUSR |
393 |
> |
#ifdef PMAP_SIGUSR |
394 |
|
signal(SIGUSR1, sigUsrDiags); |
395 |
|
#endif |
396 |
< |
|
396 |
> |
|
397 |
> |
#ifdef DEBUG_PMAP |
398 |
|
/* Output child process PID after random delay to prevent corrupted |
399 |
|
* console output due to race condition */ |
400 |
|
usleep(1e6 * pmapRandom(rouletteState)); |
401 |
< |
fprintf(stderr, "Proc %d: PID = %d\n", proc, getpid()); |
401 |
> |
fprintf(stderr, "Proc %d: PID = %d " |
402 |
> |
"(waiting 10 sec to attach debugger...)\n", |
403 |
> |
proc, getpid()); |
404 |
|
/* Allow time for debugger to attach to child process */ |
405 |
|
sleep(10); |
406 |
+ |
#endif |
407 |
|
|
408 |
|
/* ============================================================= |
409 |
|
* 2-PASS PHOTON DISTRIBUTION |
411 |
|
* Pass 2 (main): based on outcome of pass 1, estimate remaining |
412 |
|
* number of photons to emit to approximate target |
413 |
|
* count |
414 |
< |
* ============================================================= */ |
414 |
> |
* ============================================================= */ |
415 |
|
for (srcIdx = 0; srcIdx < nsources; srcIdx++) { |
416 |
|
#ifndef PMAP_SIGUSR |
417 |
|
unsigned portCnt, passCnt = 0, prePassCnt = 0; |