[mod.computers.vax] problem with sys$hiber and sys$wake

cetron%utah-ced@utah-cs.arpa.UUCP (01/25/87)

I have a program on my vaxstation gpx which doesn't work and is driving me
crazy....I've included a code fragment (it's FORTRAN, sorry :-) ).

	The general idea is to set up a mouse ast, hibernate the process 
thereby waiting for the button on the mouse to be pressed, when the ast occurs,
get the mouse position and wake up the 'main program', when awoken, the program
should print the mouse position and then (for debugging) loop back and call
sys$hiber again.

	What actually happens is that the process hibernates, the ast comes in,
the  ast executes, the return status on the sys$wake is 0 (????) and the 
'main' section is not woken up.  I have also tried using sys$wake() as well as
the sys$wake(pid) shown below....

		the code fragment:

	implicit real (a-z)
	include 'sys$library:uisentry'
	include 'sys$library:uisusrdef'
	include '($iodef)'
	include '($ssdef)'
	include '($syssrvnam)'
	external place_sensor
	integer*4 vd_id,vcm_id,wd_id,vcm_size,obj_id,ii,kk,index,copy_id
	dimension x_s(50),y_s(50),z_s(50),phi_s(50),a_s(50),b_s(50)
	common /sensor/ x_s,y_s,z_s,phi_s,a_s,b_s,wd_id,vd_id,n_sensors

	[lots of deleted code....]

	n_sensor = 0
210	type *,' place sensor number ',n_sensors+1,':'
c		set up ast when button status is changed
	call uis$set_button_ast(vd_id,wd_id,place_sensor,,keybuf)
c		hibernate until ast which will wake us up again
	call sys$hiber()
	type *,'position is: ',x_s(n_sensors),y_s(n_sensors),'keybuf',keybuf
	goto 210	! and for debugging, wait again.....


	subroutine place_sensor
	implicit real (a-z)
	include 'sys$library:uisentry'
	include 'sys$library:uisusrdef'
	dimension x_s(50),y_s(50),z_s(50),phi_s(50),a_s(50),b_s(50)
	integer*4 wd_id,vd_id,status,pid
	integer	n_sensors
	common /sensor/ x_s,y_s,z_s,phi_s,a_s,b_s,wd_id,vd_id,n_sensors

c	get pointer position....
	status = uis$get_pointer_position(vd_id,wd_id,retx,rety)
	
	n_sensors = n_sensors + 1
	x_s(n_sensors) = retx
	y_s(n_sensors) = rety
	z_s(n_sensors) = 0.
	phi_s(n_sensors) = 0.
	a_s(n_sensors) = 10.
	b_s(n_sensors) = 10.

	pid = 0
	status = sys$wake(pid)
	type *,status,pid
	if (.not.status) then
		call lib$signal(%val(status))
	endif
	return
	end



------------------------------------------

	sample output:





$ run [.design]analysis
Please enter the fixed geometric parameters:
   note that all units are radians or 
   microns unless explicitly stated....


 place sensor number            1:
          0           0
%NONAME-W-NOMSG, Message number 00000000
%TRACE-W-TRACEBACK, symbolic stack dump follows
module name     routine name                     line       rel PC    abs PC

PLACE_SENSOR    PLACE_SENSOR                     3152      00000083  00044B0F
                                                           800987C6  800987C6
                                                           80009E5E  80009E5E
ANALYSIS$MAIN   ANALYSIS$MAIN                    7063      00000A2C  00044A2C
          0           0
%NONAME-W-NOMSG, Message number 00000000
%TRACE-W-TRACEBACK, symbolic stack dump follows
module name     routine name                     line       rel PC    abs PC

PLACE_SENSOR    PLACE_SENSOR                     3152      00000083  00044B0F
                                                           800987C6  800987C6
                                                           80009E5E  80009E5E
ANALYSIS$MAIN   ANALYSIS$MAIN                    7063      00000A2C  00044A2C
          0           0
%NONAME-W-NOMSG, Message number 00000000
%TRACE-W-TRACEBACK, symbolic stack dump follows
module name     routine name                     line       rel PC    abs PC

PLACE_SENSOR    PLACE_SENSOR                     3152      00000083  00044B0F
                                                           800987C6  800987C6
                                                           80009E5E  80009E5E
ANALYSIS$MAIN   ANALYSIS$MAIN                    7063      00000A2C  00044A2C




--------------------------------

as can be seen, the ast code is executing, the pid is coming back 0 (???)
and the status is coming back 0  (????).

What have I missed?????   Thanx in advance...

-ed cetron
cetron@utah-cs.arpa
cetron@utahcca.bitnet