[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

693.0. "Calling DECwindows at AST level?" by WJG::GUINEAU () Thu Apr 27 1989 11:59

Can DECwindows routines be called from AST level?  I seem to remember something
about AST reentrancy but cant find any reference to it.

Specifically, I need to be able to update pushbutton labels from AST level.

John

T.RTitleUserPersonal
Name
DateLines
693.1GOSOX::RYANDECwindows MailThu Apr 27 1989 12:237
	No, but you can call Xlib routines from AST level. The best
	workaround for this situation (at least, it's what we do) is
	to use XSendMessage to send yourself a client event, which will
	be received and handled outside of AST level.

	Mike

693.2WJG::GUINEAUThu Apr 27 1989 12:374
Got it. Thanks!

John

693.3less overhead than client msgsSMAUG::FLOWERSIBM Interconnect Eng. 226-7716Thu Apr 27 1989 14:127
Or if possible, have your ASTs triggered by event flags instead.
The XtAppAddInput routine will accept an EFN and IOSB to trigger
off of...

Even when we couldn't supply an EFN in some cases - in our AST
routine we set the EF ourselves.

693.4KOBAL::VANNOYJake VanNoyThu Apr 27 1989 15:393
    Setting an event flag will be much more efficient that doing a
    SendEvent.

693.5big sigh....2702::WINALSKIPaul S. WinalskiThu Apr 27 1989 18:467
Setting WHICH event flag?  The documentation doesn't make clear which EF
DECwindows uses.  All I know for sure is that you can't use any of the ones
returned by LIB$GET_EF, which strikes me as pretty poor design for something
that's supposed to fit in the VMS modular programming environment.

--PSW

693.6That's the convention19584::BRANDENBERGSi vis pacem para bellumThu Apr 27 1989 18:5410
    
    re .5:  Now, now, now... Actually, it's the VMS event flag conventions
    that don't fit in the VMS modular programming environment.  Xlib needed
    an event flag for it's operations and being DIGITAL supplied, it could
    only use DIGITAL-reserved event flags.  These happen to be in ef
    cluster 0 which just happens to be exactly the cluster which isn't used
    in allocating event flags by the *typical* use of lib$get_ef.  (It just
    so happens that I was using ef cluster 1 for awhile for just this
    reason but was told "nonono".)

693.7PSW::WINALSKIPaul S. WinalskiFri Apr 28 1989 20:506
RE: .6

What we really need is a $WAITM service that will wait across multiple EFCs.

--PSW

693.81+STAR::BRANDENBERGSi vis pacem para bellumFri Apr 28 1989 21:154
    
    If you throw in the capability of optionally using IOSB's with the
    EFC's I'll gladly join the cause.

693.9Where is it written that we can only use Digital supplied EF?IO::MCCARTNEYJames T. McCartney III - DTN 381-2244 ZK02-2/N24Fri Apr 28 1989 22:0710
Most layered product that I known of (Digital-supplied of course) use GET_EF 
to get their EFNs - and SQM doesn't balk. If GET_EF is a no-no, then who saying
that?

James

P.S. I'd settle for a "X$GET_EFN" hack!


693.10so...which flags?KOALA::J_VANGILDERElectronic Mail EngineeringFri Apr 28 1989 22:1211
    
    re: .5 & .6
    
    So, is it safe to LIB$FREE_EF an event flag out of cluster 0 (doc says 1
    thru 23 are initially reserved but may be freed), and then
    LIB$RESERVE_EF that flag for use with XtAppAddInput?
    
    Does the 'condtion' arg to XtAppAddInput HAVE to be an IOSB, or can I
    safely use an $ENQ lock status block?
    

693.11free awaySTAR::BRANDENBERGSi vis pacem para bellumFri Apr 28 1989 22:268
    re .10:
    
    You certainly may lib$free_ef those event flags.  I believe the default
    behaviour of lib$get_ef was chosen as a reasonable response to previous
    bad programming practices.
    
    						m

693.12DFLAT::DICKSONtwang and toot, not beep or thudWed May 03 1989 21:034
Wether or not the EFN-management routines are well-behaved VMS modular
routines, if *DECwindows* was well-behaved, this would not be an issue because
you would be able to call it at AST level in the first place.

693.13Now you see why we use XSendEvent:-)GOSOX::RYANDECwindows MailThu May 04 1989 12:141
693.14But is it ok?19075::GUINEAUWed May 17 1989 19:3032
    re .11:
    
>    You certainly may lib$free_ef those event flags.  I believe the default
>    behaviour of lib$get_ef was chosen as a reasonable response to previous
>    bad programming practices.
 
Just to double check, this *is* safe, right?

In other words, is it possible that DECwindows has already done a
lib$reserve_ef on a cluster 0 flag *from my process context* so that
when I lib$free_ef it works thinking I'm done with that flag when
in reality DECwindows is still using it (or we are both using it :-( ) ?

Is the following code "safe":


/*
 * Allocate a cluster 0 EFNs for XtApplAddInput() and the PPL stuff in
 * ITECS_DEV
 */
efnok=0;
for(UpdateDisplayEFN = 1 ; UpdateDisplayEFN < 32 ; UpdateDisplayEFN++) {
   if(lib$free_ef(&UpdateDisplayEFN) != SS$_NORMAL) continue;
   if(lib$reserve_ef(&UpdateDisplayEFN) != SS$_NORMAL) break;
   efnok = 1;
   break;
};
if(!efnok) {
   printf("Can't get a cluster 0 EFN for XtAppAddInput!\n");
   I_CleanUpAndExit();
};

693.15maybeSTAR::BRANDENBERGSi vis pacem para bellumWed May 17 1989 21:2014
re .14:  It *may* be safe.  If some other part of the application, such as a
library, attempts to allocate event flags with a similar algorithm you'll
both end up using the same event flag which may cause a problem.  (Also,
you should restrict the free_ef loop to event flags 1 to 23.)  Another
approach is to free event flags 1 to 23 early in application startup and
then whenever the application needs an event flag, it loops trying to
reserve one in this range.  However, if some part uses the old lib$get_ef
procedure, it may be surprised to find that it received an event flag
in ef cluster 0.  You really need to know how every event flag user in
the application works.

						monty

693.16Numbered event flags are ugly51887::OLAVDo it in parallel!Thu May 18 1989 14:3929
> RE: .6
>
> What we really need is a $WAITM service that will wait across multiple EFCs.
> 
> --PSW

What really need is a higher level of abstraction than the MACRO like VMS
System Services going back to the PDP days. The EVENT type in VAXeln is a
much better concept.

VAR
    event1, event2;

BEGIN
    CLEAR_EVENT (event1);
    CLEAR_EVENT (event2);
    ...


    SIGNAL_EVENT (event2);

    ...

    WAIT_ANY (event1, event2);

This is a lot nicer than VMS event flags!

Olav

693.1719075::GUINEAUThu May 18 1989 14:5810
re .15:

I think I'm safe. All cluster 0 flags get allocated at init time (changed 
now to limit the search to 1-23).

Thanks,
John



693.18STAR::BRANDENBERGSi vis pacem para bellumThu May 18 1989 15:084
    re .16:  Except isn't it true that eln's WAIT_ANY service can only take
    four events?  What we really need is post-4.3 bsd's select() with a
    single I/O handle and built on sysV's semaphores (after fixing).

693.19QUARK::LIONELin the silence just before the dawnThu May 18 1989 18:4012
Re: .18

VAXELN is implementing a new form of WAIT_ANY/ALL that takes an
arbitrarily long list of objects to wait for.

I also agree that allocatable events are the way to go, but LIB$GET_EF
solves this problem for MOST applications.  Besides, philosophizing on
how certain fundamental design decisions for VMS should have been
made differently is not very useful.

				Steve

693.20STAR::BRANDENBERGSi vis pacem para bellumThu May 18 1989 21:268
    
>Besides, philosophizing on
>how certain fundamental design decisions for VMS should have been
>made differently is not very useful.
    
    Ah, yes, but being a critic is fun.  You know, "the cost of everything
    and the value of nothing."

693.21PSW::WINALSKIPaul S. WinalskiFri May 19 1989 03:0913
Besides which, there isn't any reason why VMS couldn't implement real semaphores
in addition to event flags.  After all, it uses them extensively internally
(that is what mutexes are).

The main reason for the existence of event flags is so that one can swap
process address space and not have to worry about posting and testing flags in
the now swapped-out address space.  The restrictions on the number of event
flags and on their association are to keep the process control block size small,
and to conserve non-paged pool.  These were more important considerations when
there were VAXes with only 256K real memory.

--PSW