Re: Global Buffer and another problem

From: George Greer (greerga@circlemud.org)
Date: 09/14/99


On Tue, 14 Sep 1999, Chuck Carson wrote:

>Are these allocated for each socket connected to the mud server?

Nope.  They're all shared.

>I notice that these buf's get set to NULL in a lot of functions as well
>as overwritten with strcpy and sprintf.

Set to NUL, not NULL.  One is a character, the other is a pointer value.

>Is it possible for two players to trigger two functions in such a manner
>that one function destroys what the other function has done with the
>buffer?

Unless you've written a multi-threaded MUD, no.  It is possible to trash
the buffers with one player by having the callee of a function smash the
buffer the caller was just using.  You have to be careful in that regard.

The GNU Pth library looks nice because, in theory, you could have a MUD
multi-threaded in design but not in running so the old global buffers would
still work (with obvious caveats).

--
George Greer            | Stock CircleMUD Bug Reporting or Help
greerga@circlemud.org   | http://bugs.circlemud.org/


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST