Fork() creates a new process. The entire memory image of the old
process is copied into the new process (well, it's copy-on-write for
most OSs, but the outcome is the same). Any changes one process makes,
cannot be seen by the other process.

So changing d->connected in the email process doesn't change
d->connected in the main process.

You're going to need to either implement this as a thread (which does
share the memory image) (google pthreads) or implement some kind of
inter-process communication. I would go with threads (although I've
never actually done threading in C or used pthreads to do threading in
C, so I can't tell you how difficult it is (it's pretty easy in
Python, though))

-David

On 8/15/06, Valnir <[EMAIL PROTECTED]> wrote:
Ok.. I'm working on an account system, and want to make sure that no two
accounts have the same email address. Don't want users having duplicate
accounts. The issue I'm having is that during account creation I'm scanning
all the existing user accounts to see if any have the same address. I'm
using fork() so that I don't have the entire mud come to a screeching halt
while it scans, but for some reason, although everything in the fork() seems
to be working fine, it doesn't set the d->connected correctly or process the
nanny function again at the end the way I'm wanting it to. Ideas? Thansk!

- Valnir

/* Code snippet */
--
ROM mailing list
[email protected]
Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom

Reply via email to