UNIXProcess system: drives CPU busy

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

UNIXProcess system: drives CPU busy

Postby daswartz » Wed Oct 31, 2007 1:11 pm

We need to call UNIX shell commands from a running Smalltalk image. We can use the system: method on UNIXProcess, but for the entire time the shell is running, we see smalltalk (esnx) processes using 100% of a cpu.

How can we invoke a shell script, wait for it to complete, and acquire its exit/return code, under UNIX without driving the CPU crazy?

We are currently using VAST 7.0 on Solaris 10.

Doug Swartz
daswartz
 
Posts: 48
Joined: Sat Oct 21, 2006 8:12 am
Location: Omaha, USA

Re: UNIXProcess system: drives CPU busy

Postby daswartz » Wed Oct 31, 2007 1:33 pm

daswartz wrote:We need to call UNIX shell commands from a running Smalltalk image. We can use the system: method on UNIXProcess, but for the entire time the shell is running, we see smalltalk (esnx) processes using 100% of a cpu.


Additional info:

If we change the UNIXProcess>>system: method to insert a Delay, ie:

| process |

process := self execute: aString.
process isNil ifTrue: [^nil].
[process isComplete] whileFalse: [(Delay forMilliseconds: 10) wait].
^process exitCode


Smalltalk no longer uses 100% of a cpu, but we no longer get the shell scripts return value. The exitCode for the UNIXProcess is always 0.
daswartz
 
Posts: 48
Joined: Sat Oct 21, 2006 8:12 am
Location: Omaha, USA


Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest