EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Understand the EPICS fdmgr functions
From: Andy Foster <[email protected]>
To: Epics Questions <[email protected]>
Date: Fri, 17 Sep 2004 11:53:56 +0100 (BST)
Dear All,

Could someone explain to me why the program below, with the
call to "ca_add_fd_registration (NULL, NULL), NULL)"
commented out, produces:

-----------------------------------------------------
A call to "assert (epicsThreadOnceCalled)" failed in
.../../../src/libCom/osi/os/posix/osdThread.c line 544.
EPICS Release EPICS R3.14.6GEM9.0 $Tag$ $Date: 2004/07/06 13:38:24 $.
Current time Fri Sep 17 2004 11:18:49.770291407.
Please E-mail this message to the author or to [email protected]
Calling epicsThreadSuspendSelf()
------------------------------------------------------

BUT, if I add in the call, it works OK.
I'm not sure what the call is really doing since I am passing
NULL arguments and haven't given it an "fd" to register.

I don't really want the program to know anything about CA, so I wonder
why I need this call at all?

I think what this really shows is that I don't
understand how to use the "fdmgr" functions and whether they are
fundamentally linked to using Channel Access in some way.

Is there any documentation on their use?

Cheers,

Andy


------------------------------------
#include <stdio.h>
#include <math.h>

#include <X11/Xlib.h>

#include "fdmgr.h"
#include "epicsTime.h"
#include "epicsAssert.h"
#include "cadef.h"

static struct timeval polltime = {30, 0};
static struct timeval tmo      = {2, 0};

void alarmCB()
{
  printf("Inside alarmCB...\n");
}

int main (int argc, char **argv)
{
    int status;
    fdmgrAlarmId aid;
    fdctx *pfdm;

    pfdm = fdmgr_init ();
    assert (pfdm);
/*   SEVCHK (ca_add_fd_registration (NULL, NULL), NULL); */
    fdmgr_add_fd(pfdm, ConnectionNumber(XOpenDisplay(NULL)), NULL, NULL);

    aid = fdmgr_add_timeout (pfdm, &tmo, alarmCB, NULL);
    assert (aid!=fdmgrNoAlarm);

    while (1) {
        status = fdmgr_pend_event (pfdm, &polltime);
        assert (status==0);
    }

    return 0;
}
------------------------------------

--------------------------------------------------------------------
Observatory Sciences Limited    Email: [email protected]
William James House             Tel: 44 - (0)1223 - 508259
Cowley Road                     Fax: 44 - (0)1223 - 508258
Cambridge, CB4 0WX, UK          http://www.observatorysciences.co.uk


Replies:
RE: Understand the EPICS fdmgr functions Jeff Hill

Navigate by Date:
Prev: Re: Xycom 9660 Andy Foster
Next: Re: GpibCore generates "broken pipe" Marty Kraimer
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Xycom 9660 Allison, Stephanie
Next: RE: Understand the EPICS fdmgr functions Jeff Hill
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·