Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!unisoft!bdt!david From: david@bdt.UUCP (David Beckemeyer) Newsgroups: comp.sys.atari.st.tech Subject: Re: RTX programming questions Message-ID: <4131@bdt.UUCP> Date: 1 Aug 90 00:24:40 GMT References: <16960002@hpldola.HP.COM> Reply-To: david@bdt.UUCP (David Beckemeyer) Organization: Beckemeyer Development Tools, Oakland, CA Lines: 45 In article <16960002@hpldola.HP.COM> jg@hpldola.HP.COM (Joe Gilray) writes: >1) I have a function that I am using as a process. I want to be able > to call this function many times and have each of the separate processes > created in this way to be able to commit suicide when they are done. > I have tried the following: > > A) p_delete((char *) NULL); > B) p_delete(p_info((char *) NULL, &state)); > The first case should work. The second argument in the second case is ignored. If it isn't working all the time, then it's likly that some RTX data structure is getting clobered. Perhaps you are overflowing your stack, or have a bad pointer, or overran a Malloc'ed area. SInce the function is started with p_create, it is also legal to simply "fall off" the end of the function or do a "return"; this also kills the process. >2) How big should I make a process's stack (the last argument to p_create)? > > I can think of two factors that affect stack size: > > A) number of arguments passed to the process > B) The depth of calls made by the process. > Another thing to watch for is using library routines supplied by the compiler vendor; these often use up lot's of stack space. You also have to factor in all "automatic" variables which also require stack space. Some RTX kernel calls also use stack space and so do some other system calls (GEMDOS, BIOS, etc.). If you can spare it, during debugging, allocate 2K or 4K for "normal" stacks, and perhaps 16K for "big" stacks. To verify stack overflows, try a really big stack like 64K and see if the problems go away. >-Joe Gilray Good Luck! -- David Beckemeyer (david@bdt.UUCP) | "I'll forgive you Dad... If you have Beckemeyer Development Tools | a breath mint." P.O. Box 21575, Oakland, CA 94620 | Bart - "The Simpsons" UUCP: {uunet,ucbvax}!unisoft!bdt!david |