we have hat many problems with exit on unix platforms. So we have written ower own methods to solve the problems. But I can't not remember me exactly on the problems.
Once was the unload problem on DB2 databases. Look the post and try it.
please, excuse me, the comment are in german. Remember, all methodes are for unix systems. I hope this can help you.
our exit: methode
AnyClassName class>>exit: anExitCode
System isRuntime
ifTrue:
[self platformExit: anExitCode withObject: nil]
ifFalse:
[GvTranscript
nextPutAll: 'IfbAdapterSystem class>>exit: '"@CMNO";
nextPutAll: anExitCode asString;
cr]
the platformExit methode for unix systems
AnyClassName class >>platformExit: anExitCode withObject: anObject
^System ifbPlatformExit: anExitCode withObject: anObject
EmSystemConfiguration>>ifbPlatformExit: errorCode withObject: anObject
"Exit the image."
self entryCount = 1 ifTrue:
["Poll all interested parties to see if this is okay."
self close ifFalse: [^self].
self
shutDown;
exiting;
ifbShutdownVM ].
^self primitiveExit: errorCode withObject: anObject
the shutDown methode for unix
EmSystemConfiguration>>ifbShutdownVM
"Shutdown the low level virtual machine and image objects.
This must be performed on every image exit."
Processor enableAsyncMessages: false.
PlatformLibrary ifbShutDown
PlatformLibrary class>>ifbShutDown
"Close all PlatformLibraries in the OS but do not
update the state of any PlatformFunctions in the image.
The PlatformFunctions update is not required because the
image is exiting.
After this method is executed, PlatformFunctions cannot
be called."
| collOfSharedLibsToUnload |
"Sonderregelung fuer AIX:
Es gab Probleme mit DB2 V8. Wenn das Programm sich beendete waren offensichtlich irgendwelche DB2-Vorgaenge noch nicht abgeschlossen (evtl.
irgendwelche Callbacks von DB2-Seite). Jedenfalls fuehrte es dazu, dass der Programm-ExitCode nicht 0 (oder was auch immer wir zurueckgeben wollten) war,
sondern 139 (oder in der Art).
Wenn wir die DB2-Bibliotheken nicht an dieser Stelle schlossen, sondern es nachher dem Betriebssystem ueberliessen, funktionierte es auch unter AIX, und
der Return-Code war 0.
Da wir nicht genau wissen, welche DB2-Bibliothek Probleme macht (db2.o oder libdb2.so oder was auch immer) nehmen wir jede Bibliothek in deren Name db2
vorkommt, vom Schliessen aus.
17.02.2006
Probleme traten jetzt auch unter Linux auf, daher obiges Verhalten auch auf Linux erweitert."
collOfSharedLibsToUnload := SharedLibraries select: [:eLib | eLib notNil].
(IfbAdapterSystem isAix or: [IfbAdapterSystem isLinux]) ifTrue:
[collOfSharedLibsToUnload := collOfSharedLibsToUnload reject: [:eLib | eLib name includesString: 'db2'].].
collOfSharedLibsToUnload do:
[:pl |
[pl primClose]
when: ExError
do: [:ex |
pl forceClose.
ex exitWith: nil].].
"evtl. muss man ja etwas warten, bevor sich die Applikation schliesst"
(Delay forSeconds: 5) wait.