Why 'primitiveShutdownNetwork absent?

ohshima at is.titech.ac.jp ohshima at is.titech.ac.jp
Wed Oct 27 04:08:45 UTC 1999


  Hi,

> If there's a real need for a shutdownNetwork primitive, I'd
> be happy to include it and just have it be a noop on the Mac.
> But is it really needed?

  The short answer is "yes".  read the following written in
my bad English if you want to know why.  (somehow, I really
lost the confidence in my skill of english, sigh.)

  ...

  I think I wrongly mixed two different things.  The network
shutdown and the PPP connection.

  There is the declaration for sqNetworkShutdown() exist in
"sq.h".  I think the porter is supposed to define the
function to be "symmetric" to the sqNetworkInit().

  On Windows, as far as I know, the network is automatically
initialized by OS when the network API is called first time.
The network is alive until the user select the "disconnect"
button.

  On some UNIX, the user might have to invoke "ppp" command
or something to start the network session if the machine is
not directly connected to the network.  Anyway, the network
support code doesn't do anything about the network session.

  In either case, the symmetricity of the network support
code seems kept.

  On ZaurusOS, the sqNetworkInit() have to call the network
init API explicitly.  Likewise, the application have to call
the network shutdown API.  In fact, there is no other way to
shutdown the network session.

  Of course, I wrote the sqNetworkShutdown() to be called
from ioExit(), but it is still better to have a way to call
sqNetWorkShutdown() manually.

>   a. It's not entirely clear when you'd want to use this primitive,
>      since some other Squeak process might still be using the
>      network.

  Yes, but the same thing can be applied to the other
primitive, such as the change of display depth and extent.

  If the user is sure to shutdown the network, I think the
user should be able to.

# I could put an OS-native button on the screen for it and
# don't modify current Squeak, but I think it is not clean.

>      In contrast, primitiveInitializeNetwork is
>      implemented in a way that it does nothing if the network has
>      already been initialized, so every piece of code that uses
>      the network can safely begin by calling primitiveInitializeNetwork.

  Yes.

>   b. The VM itself must be sure to clean up any network resources
>      when the user quits or even if the VM crashes. The Mac version
>      of Squeak patches the application exit code to ensure that this
>      cleanup happens. If you don't do this on the Mac, you can
>      have interrupt code that tries to call a completion routine
>      that's no longer there, an almost certain way to crash the
>      Mac. (In more sensible OS's with memory protection, of course,
>      this wouldn't happen.)

  As I wrote above, I just put the call to
sqNetworkShutdown() in ioExit().  But I'm not so sure what
is going to happen when ZaurusOS crashes.

  ... The situation of Mac seems somewhat special.  Is it
because the applications share the same address space with
OS?  I thought the user is supposed to reboot Mac when the
VM crashes:-)

  Thank you.

                                             OHSHIMA Yoshiki
                Dept. of Mathematical and Computing Sciences
                               Tokyo Institute of Technology 





More information about the Squeak-dev mailing list