I've been working on this code for 2 days now and i finally think i got the while loop running correctly but now i cant seem to print the child process id's. The code starts with the parent process forking 3 child processes. Then the parent must wait till a child terminates to print out that child's PID. Any tips to fix my output is greatly appreciated. #include <stdio.h> //exit function #include <stdlib.h> //unix functions #include <unistd.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h> #define SHMKEY ((key_t) 7890) typedef struct { int value; } shared_mem; shared_mem *total; /*----------------------------------------------------------------------* * This function …

Member Avatar
Member Avatar
+0 forum 1

You can tell a lot about a company by the way they treat the employees lowest on its pay scale. Pay cuts and, yes, even layoffs are inevitable in today's economic climate. The decisions are painful, but they're often necessary and unavoidable. They aren't, however, a license to be callous and cold toward the very people who have kept your business running. Computer vendor HP recently announced significant across the board pay cuts for everyone starting at the top down -- and I do mean everyone. All 100,000 employees on the payroll at HP will suffer some sort of reduction …

Member Avatar
Member Avatar
+0 forum 7

How can I terminate resources in a safe way when JFrame is about to close? - If I put terminate() in the a finally block it runs before windowClosing(). - If I put terminate in windowClosing() it can't be accessed from an inner class. I am aware that I shouldn't use finalize(), but I don't know from where (and how) should I call my terminate() method. Is there an "official" way to **close a JFrame with windowClosing() and do some tasks** (save data, close streams) **before** the program **exits**? **Where should I put my terminate() method?** public class Test extends …

Member Avatar
Member Avatar
+0 forum 2

the answer to this i found on the web was this: The AWT event dispatcher thread is not a daemon thread. You must explicitly call System.exit to terminate the JVM. and what i understand of it is that the thread which is terminated when we close a JFrame or Applet is that the thread associated with that is not the main thread which runs when jvm starts. that is, my understanding of the 'daemon' thread in the above answer is that its the main thread that jvm executes on - backbone thread of jvm. so any jframe app we run …

Member Avatar
Member Avatar
+0 forum 5

Hi, I have a for-loop, and in each iteration I have to open a dos-command. I use the subprocess module for this: [code=python] fid1=open("test.txt", 'w') p=subprocess.Popen(args, stdout=fid1, stderr=subprocess.STDOUT, shell=True) fid1.close() [/code] The output of the dos-command is written to the txt-file, but I still need to terminate the process p. p.wait() returns 0, which is ok, but when I do p.terminate() I get: WindowsError: [Error 5] Access is denied The process isn't closed, and during the next iteration a new process is started. In a short time I have hundreds of un-terminated processes. Any ideas? Thanks in advance, (I tried …

Member Avatar
+0 forum 0

The End.