Linux Users

cancel
Showing results for 
Search instead for 
Did you mean: 

Help me to Daemonize NiDaqMxBase : Lock in DAQmxBaseStartTask after fork()

Hello,

I just finish an acquisition processus based on Linux and NiDAQMxBase 3.4 with a USB-6009.
This work well in console mode but this process is dedicated to work in background like daemon.
So i write some lines to daemonize my process but i get lock into "DAQmxBaseStartTask" !
To reproduce this probleme i do simple modification into "acquireNScans.c" and name it "acquirefork.c"
I add some lines to be able daemonize this processus and starting in background and change output to get result into console AND syslog
* Without argument it act like original acquireNScans.c witch log into syslog
* With --fork argument program start in background
So when i do
./acquirefork           // this work well
./acquirefork --fork    // DEADLOCK on DAQmxBaseStartTask
I can reproduce this over OpenSuze5, Redhat11.2 and Debian6.0
(Source and make  files is joined)
* Can someone help me ? (did you reproduce this too) ?
* I do a mistake in my daemonize lines ?
* Can you help me to debug more deeper ? i don't known how to do tosee what happend at this ?
Thanks in advance
Rom1nux
PS: Sorry for my bad english
PS2: You can compile programme with supplied Makefile
Download All
0 Kudos
Message 1 of 3
(4,384 Views)

Hum...I'm autoresponding myself....

I just foun this : https://decibel.ni.com/content/message/19311#19311

I'm going to put my process in .so and load it dynamically at judicious moment.

Apparently dynamic loading look like this :

#include <dlfcn.h>

#include <stdio.h>

main()

{

void *libc;

void (*printf_call)();

if(libc=dlopen("/lib/libc.so.5",RTLD_LAZY))

{

printf_call = dlsym(libc,"printf");

(*printf_call)("Bonjour ! Ha ben ca marche pil poil sous Linux !\n");

}

}

So sorry for disturbing...

Rom1nux

0 Kudos
Message 2 of 3
(3,282 Views)

Hello,

I be able to put all my nidaqbase code into a shared lib, but i got an ther problem, DAQmxBaseReadAnalogF64 never update the sample read count !

https://decibel.ni.com/content/message/24454

Please help me

Rom1nux

PS : I make an other thread because it' not the same probleme, but  problems are effectively linked, i hop it's not a problem ?

0 Kudos
Message 3 of 3
(3,283 Views)