Hi
I am writing an AsynPortDriver class for the libera spark and I would like to do the waveforms data acquisition in a separate thread (attached is my initial implementation). Whenever a large data size requested (Using command "ADC 100" for example), the IOC
crashes with the following message:
dbGetLinkValue: Illegal link type -13664
Segmentation fault
Noticing that this number is random at every time the IOC crashes. Right now I am trying to enable core dumps on my machine (for some reason they are not dumped), but in the meantime, what is wrong with my thread implementation?
Is it possible to have a variable length waveform record in EPICS? If yes, how does asyn implements this?
Best Regards,
Abdalla.
|
void LiberaSpark::performDAQ()
{
printf("DAQ Thread initialized!\n");
string line = "";
char* command = (char*) "ADC 200\n";
int status;
ssize_t bytes;
char buffer[48];
struct pollfd polling_fds[1];
polling_fds[0].fd = this->device_socket;
polling_fds[0].events = POLLIN;
polling_fds[0].revents = 0;
while(true)
{
lock();
pthread_mutex_lock(&device_mutex);
bytes = write(device_socket, command, strlen(command));
status = poll(polling_fds, 1, 1);
int i = 0;
while(status > 0)
{
memset(buffer, 0, sizeof(buffer));
bytes = read(device_socket, buffer, sizeof(buffer));
buffer[bytes - 1] = '\0';
stringstream ss(buffer);
cout << ss.str() << endl;
while(ss >> line)
{
if(i % 4 == 0)
adc_a[i / 4] = atoi(line.c_str());
i++;
}
status = poll(polling_fds, 1, 1);
}
pthread_mutex_unlock(&device_mutex);
unlock();
sleep(1);
}
}
- Replies:
- RE: AsynPortDriver separate thread causes Segmentation fault with "dbGetLinkValue" error message Mark Rivers via Tech-talk
- Navigate by Date:
- Prev:
RE: ADDexala build error Mark Rivers via Tech-talk
- Next:
Re: ADDexala build error John Dobbins via Tech-talk
- 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:
RE: ADDexala build error Engbretson, Mark S. via Tech-talk
- Next:
RE: AsynPortDriver separate thread causes Segmentation fault with "dbGetLinkValue" error message Mark Rivers via Tech-talk
- 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
|