12 "{ Package: 'stx:libbasic' }" |
14 "{ Package: 'stx:libbasic' }" |
13 |
15 |
14 "{ NameSpace: Smalltalk }" |
16 "{ NameSpace: Smalltalk }" |
15 |
17 |
16 Link subclass:#Process |
18 Link subclass:#Process |
17 instanceVariableNames:'id lookupActivations lookupDisabled prio state startBlock name restartable |
19 instanceVariableNames:'id lookupActivations lookupDisabled prio state startBlock name |
18 interruptActions exitActions suspendSemaphore singleStepping |
20 restartable interruptActions exitActions suspendSemaphore |
19 emergencySignalHandler suspendActions creatorId processGroupId |
21 singleStepping emergencySignalHandler suspendActions creatorId |
20 interruptsDisabled priorityRange exceptionHandlerSet processType |
22 processGroupId interruptsDisabled priorityRange |
21 environment' |
23 exceptionHandlerSet processType environment' |
22 classVariableNames:'TerminateSignal RestartSignal CaughtSignals' |
24 classVariableNames:'TerminateSignal RestartSignal CaughtSignals' |
23 poolDictionaries:'' |
25 poolDictionaries:'' |
24 category:'Kernel-Processes' |
26 category:'Kernel-Processes' |
25 ! |
27 ! |
26 |
28 |
375 |
377 |
376 defaultMaximumStackSize |
378 defaultMaximumStackSize |
377 "return the default max stack size. All new processes get |
379 "return the default max stack size. All new processes get |
378 this limit initially. |
380 this limit initially. |
379 It may be changed for individual processes with: |
381 It may be changed for individual processes with: |
380 aProcess setMaximumStackSize:limit" |
382 aProcess setMaximumStackSize:limit" |
381 |
383 |
382 %{ /* NOCONTEXT */ |
384 %{ /* NOCONTEXT */ |
|
385 extern INT __defaultThreadMaxStackSize(); |
383 |
386 |
384 RETURN ( __mkSmallInteger( __defaultThreadMaxStackSize() )); |
387 RETURN ( __mkSmallInteger( __defaultThreadMaxStackSize() )); |
385 %} |
388 %} |
386 |
389 |
387 " |
390 " |
393 |
396 |
394 defaultMaximumStackSize:numberOfBytes |
397 defaultMaximumStackSize:numberOfBytes |
395 "set the default max stack size, return the previous value. |
398 "set the default max stack size, return the previous value. |
396 All new processes get this stack limit initially. |
399 All new processes get this stack limit initially. |
397 It may be changed for individual processes with: |
400 It may be changed for individual processes with: |
398 aProcess setMaximumStackSize:limit |
401 aProcess setMaximumStackSize:limit |
399 Notice: |
402 Notice: |
400 There is seldom any need to change the default setting, |
403 There is seldom any need to change the default setting, |
401 except for highly recursive programs." |
404 except for highly recursive programs." |
402 |
405 |
403 %{ /* NOCONTEXT */ |
406 %{ /* NOCONTEXT */ |
|
407 extern INT __threadSetDefaultMaxStackSize(); |
404 |
408 |
405 if (__isSmallInteger(numberOfBytes)) { |
409 if (__isSmallInteger(numberOfBytes)) { |
406 RETURN ( __mkSmallInteger(__threadSetDefaultMaxStackSize(__intVal(numberOfBytes)) )); |
410 RETURN ( __mkSmallInteger(__threadSetDefaultMaxStackSize(__intVal(numberOfBytes)) )); |
407 } |
411 } |
408 %} |
412 %} |
409 |
413 |
410 " |
414 " |
411 Process defaultMaximumStackSize:500*1024 |
415 Process defaultMaximumStackSize:500*1024 |
412 " |
416 " |
413 |
417 |
414 "Modified: 8.5.1996 / 10:23:26 / cg" |
418 "Modified: 8.5.1996 / 10:23:26 / cg" |
|
419 ! |
|
420 |
|
421 wrapStackSize |
|
422 "return the wrap stack size. |
|
423 Under windows, blocking API calls are executed on a separate stack with this size. |
|
424 If you ever encounter that a call to n external library function requires more stack than |
|
425 this, you may change this size in your startup (or programmatically) during early startup. |
|
426 Returns nil on non-windows machines." |
|
427 |
|
428 %{ /* NOCONTEXT */ |
|
429 INT sz = 0; |
|
430 |
|
431 #ifdef WIN32 |
|
432 extern INT __getWrapStackSize(); |
|
433 |
|
434 sz = __getWrapStackSize(); |
|
435 #endif |
|
436 RETURN (__MKINT(sz)); |
|
437 %} |
|
438 ! |
|
439 |
|
440 wrapStackSize:newSize |
|
441 "set the wrap stack size. |
|
442 Under windows, blocking API calls are executed on a separate stack with this size. |
|
443 If you ever encounter that a call to n external library function requires more stack than |
|
444 this, you may change this size in your startup (or programmatically) during early startup. |
|
445 An argument of 0 changes the size back to the default. |
|
446 Returns the previous size." |
|
447 |
|
448 %{ /* NOCONTEXT */ |
|
449 INT __oldSize = 0; |
|
450 |
|
451 if (__isSmallInteger(newSize)) { |
|
452 INT __newSize = __intVal(newSize); |
|
453 |
|
454 if (__newSize >= 0) { |
|
455 #ifdef WIN32 |
|
456 extern INT __setWrapStackSize(INT); |
|
457 |
|
458 __oldSize = __setWrapStackSize(__newSize); |
|
459 #endif |
|
460 } |
|
461 } |
|
462 RETURN (__MKINT(__oldSize)); |
|
463 %} |
415 ! ! |
464 ! ! |
416 |
465 |
417 !Process class methodsFor:'instance retrieval'! |
466 !Process class methodsFor:'instance retrieval'! |
418 |
467 |
419 findProcessWithId:id |
468 findProcessWithId:id |
783 "returns the processes stack limit - i.e. the process will be |
831 "returns the processes stack limit - i.e. the process will be |
784 interrupted with a recursionSignal-raise, if it ever |
832 interrupted with a recursionSignal-raise, if it ever |
785 needs more stack (in bytes) than this number" |
833 needs more stack (in bytes) than this number" |
786 |
834 |
787 %{ /* NOCONTEXT */ |
835 %{ /* NOCONTEXT */ |
788 extern int __threadMaxStackSize(); |
836 extern INT __threadMaxStackSize(); |
789 OBJ i; |
837 OBJ i; |
790 |
838 |
791 if (__isSmallInteger(i = __INST(id))) { |
839 if (__isSmallInteger(i = __INST(id))) { |
792 RETURN( __mkSmallInteger(__threadMaxStackSize(__intVal(i))) ); |
840 RETURN( __MKINT(__threadMaxStackSize(__intVal(i))) ); |
793 } |
841 } |
794 %}. |
842 %}. |
795 ^ nil |
843 ^ nil |
796 ! |
844 ! |
797 |
845 |
800 interrupted with a recursionSignal-raise, if it ever |
848 interrupted with a recursionSignal-raise, if it ever |
801 needs more stack (in bytes) than this number. |
849 needs more stack (in bytes) than this number. |
802 Returns the old value." |
850 Returns the old value." |
803 |
851 |
804 %{ /* NOCONTEXT */ |
852 %{ /* NOCONTEXT */ |
805 extern int __threadSetMaxStackSize(); |
853 extern INT __threadSetMaxStackSize(int, unsigned INT); |
806 OBJ i; |
854 OBJ i; |
807 |
855 |
808 if (__isSmallInteger(i = __INST(id)) |
856 if (__isSmallInteger(i = __INST(id)) |
809 && __isSmallInteger(limit) ) { |
857 && __isSmallInteger(limit) ) { |
810 RETURN ( __mkSmallInteger(__threadSetMaxStackSize(__intVal(i), __intVal(limit))) ); |
858 RETURN ( __MKINT(__threadSetMaxStackSize(__intVal(i), __intVal(limit))) ); |
811 } |
859 } |
812 %}. |
860 %}. |
813 ^ nil |
861 ^ nil |
814 ! |
862 ! |
815 |
863 |
816 setStackInitialSize:initial increment:increment safe:safe |
864 setStackInitialSize:initial increment:increment safe:safe |
817 "hook for fine-tuning. Sets the processes initialStackSize- and |
865 "hook for fine-tuning. Sets the processes initialStackSize- and |
818 and stackIncrement-parameters. Not for normal use." |
866 and stackIncrement-parameters. Not for normal use." |
819 |
867 |
820 %{ /* NOCONTEXT */ |
868 %{ /* NOCONTEXT */ |
821 extern int __threadSetJunkSizes(); |
869 extern INT __threadSetJunkSizes(int, unsigned INT, unsigned INT, unsigned INT); |
|
870 |
822 OBJ i; |
871 OBJ i; |
823 |
872 |
824 if (__isSmallInteger(i = __INST(id)) |
873 if (__isSmallInteger(i = __INST(id)) |
825 && __isSmallInteger(initial) |
874 && __isSmallInteger(initial) |
826 && __isSmallInteger(increment) |
875 && __isSmallInteger(increment) |
827 && __isSmallInteger(safe)) { |
876 && __isSmallInteger(safe)) { |
828 RETURN ( __threadSetJunkSizes(__intVal(i), __intVal(initial), __intVal(increment), __intVal(safe)) ? true : false ); |
877 RETURN ( __threadSetJunkSizes(__intVal(i), __intVal(initial), __intVal(increment), __intVal(safe)) ? true : false ); |
829 } |
878 } |
830 %}. |
879 %}. |
831 ^ false |
880 ^ false |
832 ! ! |
881 ! ! |
833 |
882 |
1023 |
1072 |
1024 numberOfStackBoundaryHits |
1073 numberOfStackBoundaryHits |
1025 "internal monitoring only - will vanish" |
1074 "internal monitoring only - will vanish" |
1026 |
1075 |
1027 %{ /* NOCONTEXT */ |
1076 %{ /* NOCONTEXT */ |
1028 extern int __threadNumberOfStackBoundaryHits(); |
1077 extern INT __threadNumberOfStackBoundaryHits(); |
1029 int n; |
1078 INT n; |
1030 OBJ i; |
1079 OBJ i; |
1031 |
1080 |
1032 if (__isSmallInteger(i = __INST(id))) { |
1081 if (__isSmallInteger(i = __INST(id))) { |
1033 n = __threadNumberOfStackBoundaryHits(__intVal(i)); |
1082 n = __threadNumberOfStackBoundaryHits(__intVal(i)); |
1034 n &= _MAX_INT; |
1083 n &= _MAX_INT; |
1035 RETURN( __mkSmallInteger(n) ); |
1084 RETURN( __mkSmallInteger(n) ); |
1036 } |
1085 } |
1037 %}. |
1086 %}. |
1038 ^ nil |
1087 ^ nil |
1039 ! |
1088 ! |
1040 |
1089 |
1041 numberOfStackSegments |
1090 numberOfStackSegments |
1042 "return the processes number of stack segments currently used. |
1091 "return the processes number of stack segments currently used. |
1043 This method is for monitoring purposes only - it may vanish." |
1092 This method is for monitoring purposes only - it may vanish." |
1044 |
1093 |
1045 %{ /* NOCONTEXT */ |
1094 %{ /* NOCONTEXT */ |
1046 extern int __threadTotalStackSize(); |
1095 extern int __threadStackSegments(); |
1047 OBJ i; |
1096 OBJ i; |
1048 |
1097 |
1049 if (__isSmallInteger(i = __INST(id))) { |
1098 if (__isSmallInteger(i = __INST(id))) { |
1050 RETURN( __mkSmallInteger((INT)__threadStackSegments(__intVal(i))) ); |
1099 RETURN( __mkSmallInteger((INT)__threadStackSegments(__intVal(i))) ); |
1051 } |
1100 } |
1052 %}. |
1101 %}. |
1053 ^ nil |
1102 ^ nil |
1054 ! |
1103 ! |
1055 |
1104 |
1056 totalStackSize |
1105 totalStackSize |
1057 "return the processes maximum used stack size. |
1106 "return the processes maximum used stack size. |
1058 This method is for monitoring purposes only - it may vanish." |
1107 This method is for monitoring purposes only - it may vanish." |
1059 |
1108 |
1060 %{ /* NOCONTEXT */ |
1109 %{ /* NOCONTEXT */ |
1061 extern int __threadTotalStackSize(); |
1110 extern INT __threadTotalStackSize(); |
1062 OBJ i; |
1111 OBJ i; |
1063 |
1112 |
1064 if (__isSmallInteger(i = __INST(id))) { |
1113 if (__isSmallInteger(i = __INST(id))) { |
1065 RETURN( __mkSmallInteger(__threadTotalStackSize(__intVal(i))) ); |
1114 RETURN( __MKINT(__threadTotalStackSize(__intVal(i))) ); |
1066 } |
1115 } |
1067 %}. |
1116 %}. |
1068 ^ nil |
1117 ^ nil |
1069 ! |
1118 ! |
1070 |
1119 |