Firmin,
You need to call "ca_task_initialize()" prior to calling
"ca_add_fd_registration()". The attached modification of
your source works correctly. Most of the CA functions
will call "ca_task_initialize()" for you if you forget to
take care of it, but this one does not. I will make this
one consistent with the others in EPICS 3.13.
Jeff
#include <stdio.h>
#include "cadef.h"
void FdRegHandler(void *, int, int);
int main()
{
int CaStatus;
int vparm;
CaStatus = ca_task_initialize();
SEVCHK(CaStatus,"ca init failed");
CaStatus = ca_add_fd_registration(FdRegHandler,&vparm);
return 0;
}
void FdRegHandler(void *vparm, int fd, int cond)
{
printf("In FdRegHandler\n");
}
On Thursday, July 17, 1997 2:19 PM, Firmin Oliveira
[SMTP:[email protected]] wrote:
> Hello,
>
> I have little to no EPICS channel access experience
>
> I have been trying to run my program with ca_add_fd_registration. It
> compiles/links okay, but when run it produces a segmentation fault upon
> entry into ca_add_fd_registration. I have tried every combination of
> arguments I know into the routine but it continually gets a segmentation
> fault. When the ca_add_fd_registration statement is commented out, the rest
> of the
> channel access routines work just fine (ca_task_initialize,
> ca_search_and_connect, ca_get, SEVCHK, ca_add_event.) To be more specific
> about the problem:
>
> include "cadef.h"
> void FdRegHandler(void *, int, int);
> ...
>
> main()
> {
> int CaStatus;
> my_struct vparm;
> ...
>
> CaStatus = ca_add_fd_registration(FdRegHandler,&vparm);
> (Note: Segmentation fault occurs in above statement)
> ...
>
> }
>
> void FdRegHandler(void *vparm, int fd, int cond)
> {
> printf("In FdRegHandler\n"); (Note: this does not get printed)
> }
>
>
> Any help you can give would be appreciated.
>
> Aloha,
>
> Firmin Oliveira
>
- Navigate by Date:
- Prev:
base release 3.13.0beta11 Marty Kraimer
- Next:
European EPICS Meeting J.F. Gournay
- Index:
1994
1995
1996
<1997>
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
EPICS fd registration problem Firmin Oliveira
- Next:
base release 3.13.0beta11 Marty Kraimer
- Index:
1994
1995
1996
<1997>
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|