Why using the driver NOR-DAQmx ANSI C functions in a thread causes a deadlock?

Firstly, apologies if this is bad advice, but it seemed the closest fit.

I use MSVC 2008 Express with the library in ANSI C NI DAQmx for some analog output with a box USB-6009. I create a thread to handle the signal generation is based on fixed time. My main thread running the user interface. I found that I get intermittent blockages in release, so that libraries mode NOR are responsible (in the second thread) and I use MSVCRT features (on the main thread). My test code is attached as "deadlock2.cpp".

I used WinDbg to try to find the cause of the deadlock. Traces of the battery of my two sons are attached as t1_stack.txt and t2_stack.txt.

It seems that the MSVCRT localtime() function uses a lock when it is called for the first time and then went to lock the Windows DLL loader lock. At the same time libraries NOR (or less libraries mxs) are responsible for locking the charger DLL is being held. The mxsutils library uses getcwd() which seems to try to block something the MSVCRT and therefore my two sons are now deadlocked.

I can probably work around this by calling the localtime() and the NOR-DAQmx functions before I spawn my second thread so that the DLLs are already loaded in the process. However, I have no guarantee of this to continue working if something changes in the future, and if there are any locks going on finally having the DllMain() calls for a thread hanging may still cause a deadlock. If my results are correct, is it likely that NEITHER would fix the dll for not trying to make something complex in their DllMain()?

According to NI Measurement and Automation Explorer, I'm under DAQmx libraries v9.3.5f2. I download the latest version now to try, but it will take time.

Hi dmcminn,

Thank you for the comprehensive and detailed bug report. I was able to reproduce the problem with NOR-DAQmx 9.6 using the code you posted. I reported it to the R & D team suitable as CAR #366538.

I agree with your analysis of the problem. Getcwd() so the first call to __tzset() acquired _ENV_LOCK, which Microsoft has documented as the "lock for environment variables. __tzset() also called GetTimeZoneInformation(), which can load additional libraries, that you have demonstrated.

Here are a couple more possible solutions, but they are not great:

  • Link to the static version of the CRT (/ MT instead of /MD). This would bind a separate copy of the lock of the CRT table in your program, and DAQmx would continue to use the lock to MSVCR90.dll table. They use more of the same _ENV_LOCK.
  • Build using a different version of Microsoft Visual C++ (for example 2005 or 2010). MSVCR80.dll MSVCR90.dll and MSVCR100.dll own separate copies of the lock of the CRT table.

Whatever it is, it does not eliminate the fact that mxsutils called the CRT while now the loader lock, and this function CRT acquires another lock.

Furthermore, the forum Multifunction DAQ is a better place to ask questions DAQmx.

Brad

Tags: NI Software

Similar Questions

  • RT system timeout when updating the driver NOR-DAQmx 8.9.5 to 9.0.2

    I installed LabVIEW 2009 on my host (Window XP) which has now NOR-DAQmx 9.0.2 installed.  My remote RT chassis has NEITHER-DAQmx 8.9.5 installed.   I need to have versions of NOR-DAQmx match on my host computer and remote systems.  I tried to install the driver OR DAQmx 9.0.2 my host by using the LabVIEW Real-time Software Wizard.  The Installer tries to restart the remote chassis on the installation mode but expires and returns the error Code 56.  How can I get my versions to match?

    Problem caused by the wrong installation order.  Necessary to install 9.0 RT first on target.  NOR-DAQmx has been updated at the same time.

  • Install the driver OR DAQmx 9.7.0 Application Development Support

    Hello

    I'm currently trying to install Labview 2009 (my old copy was lost in case of overheating of the motherboard of my old computer). The installation went very well, I think, and I am able to create new projects etc.

    When I downloaded the driver NOR-DAQmx 9.7 (full installer), I seem to be impossible to install several pieces of software - please see the attached file error. I'm not worried about the track of I/O OR 3.0.2, NI MAX 5.4 or NI Network Browser 5.4.0 because I think higher editions I have are backward compatible.

    With the support for development applications OR DAQmx 9.7.0 however, impossible to install this because of incompatible products. Do you know what kind of products, this error refers to? I am at a loss, because I don't know what the symbol shown in the screenshot (I accessed this window with a custom train installation, but I can't change to a tick/cross).

    Thank you in advance!

    Carl

    Hi James,

    Thanks for responding. I managed to fix the error: I found that the version of NI-VISA installed on my computer was version 5.4, which is not compatible with LabView 2009. As soon as I uninstalled it and instead added version 5.3, I was able to install DAQmx ADE without problem.

    Thank you once again!

    Carl

  • Impossible to install the driver OR DAQmx on Win7 x 64

    I'm running Windows 7 x 64 and try to install the driver OR DAQmx 9.0.2.  However, the first time I did it, I got a partial installation.  Subsequent attempts to re - install give me the message that I need to first uninstall.  However, the program is not listed in install/uninstall programs.  I tried to run the cleaning for Vista, but it tells me that I have x 64 Windows so it does nothing.  So I'm stuck now impossible to uninstall what remaining NOR-DAQmx stuff is on my PC and cannot install again.  If you have advice on what to do, let me know.

    Thank you.

    Hey ness.

    Try to use MSI Blast to walk through the steps described in the pdf document.  Hope this helps!

  • RN102 - please remove inactive volumes in order to use the drive - data loss

    ReadyNas 102, 1 x 1 TB of disk (in 2nd driving position), belonging to 10 days, using 6.2.5

    I copied perhaps 25 data DVD disk (1 volume, through about 4 servings). I have lost the network connection to the NAS server, could not get the sin to meet switch & finally upluged the power from the back, after a reboot that worked was & when reconnecting, I note ALL my data drive disappeared. No matter what I do with the power, I shouldn't be able to have this catastrophic failure.

    If I go to Volumes, it shows the volume, with a red dot in the upper left, with the data and free are two 0.

    also a ball - please remove inactive volumes in order to use the drive. Disk #2.

    If I go to actions it says: no volume or USB drives. It is recommended to create a volume before you set up other...

    If I had 2 drives (copies of each other) would I still lost all of these data. It seems that the reliability of disc is not my main concern, but the speaker.

    I've never had a pc lose all his data by car, make it look training crashed as the s/w me invites to use it. It looks like the o/s meta data, manage the contents of the disk are broken down.

    Is this code issues I may be courses?

    You have the USB key with the encryption key connected to the NAS Server? The key must be plugged to the volume mounted power.

    Looks like you will need to contact support.

  • Uninstall the Driver nor visa 3.0.1 to install 4.2

    Hi all

    I need to install the Driver or visa 4.2, but should I uninstall visa or 3.0.1 firstly to let the 4.2 to be effective.

    But I have some problems to uninstall the Driver nor visa 3.0.1.

    I wait your help for how to uninstall it.

    Thank you

    Thank you for your attention.

    I'm new on this. I just found how I can uninstall it from Add/Remove control panel part.

    Thanks for your time

    Problem is solved.

  • Why using the typewriter in acrobat 9 adds less file size that the use of the text of the comment in acrobat 11 tool?

    Why using the typewriter in acrobat 9 adds less file size that the use of the text of the comment in acrobat 11 tool?

    Two employees, one using acrobat 9 and the other uses acrobat 11. The two employees open a secure document one page 105 KB in size. Used using acrobat 9 using the typewriter tool to add comments. Document increases in volume to 137 kb. Second employee using acrobat 11 uses the comment add the text tool (since it is no longer a typewriter tool). This employee has to use tool once and the document immediately increases size of 105 k to 950 + kb. Why is this? What can be done to avoid this?

    As I suspected much earlier, the difference is in the fonts that are used for the text. For the smaller file, text annotation font is Times Roman. that is a policy that is essentially built into Acrobat/Reader. For the larger file, the font is Tahoma, which is not an integrated police force, which ends by happens so the entire police gets embedded in the PDF file. The size of this font on disk file is 681KO on my system (Mac), and it ends up taking more space when they are embedded in the PDF file. The same type of thing happens with form fields and this is done so that all characters in the font are available when the text is changed in a system that may not have the installed font.

    One of the problems is if you try to reduce the size of the file by changing the font that used up one of the built-in ones (Courier, Helvetica, TImes Roman), Acrobat does not remove the now unused of the file font information, if you do not get the reduction in file size that you can imagine, even if the font is no longer presented as being incorporated. I submitted this as a bug some time ago, but it has not been fixed.

  • Why use the collections?

    Please help me to better understand and to right the next point

    to move from a PPT available in internet, I read a sentence under the heading "Why use collections?" Please find here

    Use of complex data sets information to host non-PL/SQL environments using table functions

    I think I understand: it means that complex data sets can be collected from oracle using only a single sql statement by using the installation, called Oracle Pipelined Table functions. http://www.akadia.com/services/ora_pipe_functions.html]

    Is any other installation in oracle to the serveup of complex datasets of the information to the host non-PL/SQL environments?

    Published by: o Manjusha Muraleedas, error corrected spelling.

    I watched the presentation and here's how I read it (although you might be better to ask the author):

    Manjusha Muraleedas wrote:
    My question is, why the statement "Serve up complex data sets of information to host non-PL/SQL environments using table functions" came under the title "Why use collections?". Just because there's an installation? or any other really good news?

    There is a hypothesis that is unwritten in the presentation: "complex" data is data that must be handled in PL/SQL, because only SQL does not work.

    Nowhere the author says that a pure SQL solution should be changed into a solution of PL/SQL.

    Once you decide that you must use the PL/SQL, you might want to put your data in collections in scalar variables.

    I understand, complex data, works of art (suppose a structure with 3 columns of tables joing 5) can be meet non-pl/sql envirormment like Java, the use of the ref Cursor or xml. Collection using to do the same thing, this is not a good option.

    Again, I think that the author uses "complex" as a shortcut for 'need to PL/SQL in the first place'. If the data must be processed in PL/SQL, there is no need to use PL/SQL scalar variables or collections.
    I would say "use of the ref Cursor. Providing relational data in format XML should be the exception, not the rule. It has a cost of additional performance.

    Now lets talk about pipeline table functions.
    ...
    functions table pipeline reached the performance of parallel processing. so even if binding commodity of time and memory is there, it will be performs better than refcursors or xml?

    Pipeline table functions perform no better than the ref Cursor. There are two processes running, one to SELECT and the other for the function, there will be more work on the server. With a ref cursor, there is a fair process to return the data.

    Parallel processing is not a problem. If you can make it work in plain SQL, you can do in parallel in SQL simple.

    Published by: Ashton stew on January 22, 2013 16:44

  • Why use the symbol "!" here?

    Why use the symbol "!" here?
    If (! contactOld.getWorkAddress) .equals)
    ...
    public void entryUpdated(MapEvent event)
    {
    Contact contactOld = (Contact)event.getOldValue();
    Contact contactNew = (Contact)event.getNewValue();
    StringBuffer sb = new StringBuffer();
    if (!contactOld.getHomeAddress().equals(
    contactNew.getHomeAddress()))
    {
    sb.append("Home address ");
    }
    if (!contactOld.getWorkAddress().equals(
    contactNew.getWorkAddress()))
    {
    sb.append("Work address ");
    }
    if (!contactOld.getTelephoneNumbers().equals(
    contactNew.getTelephoneNumbers()))
    {
    sb.append("Telephone ");
    }
    
    sb.append("was updated for ").append(event.getKey());
    System.out.println(sb);
    }

    The "!" reverse value.

  • Why use the symbol {} in the following script?

    Why use the symbol * {} * in the following script?
    < reading-writing-support-map-plan >
    < scheme name > SampleDatabaseScheme < / system-name >
    < internal-cache-system >
    < local plan >
    < system-Ref > SampleMemoryScheme < / plan-ref >
    < / local plan >
    < / internal-cache-system >
    < dumps-plan >
    schema < class >
    > class name < com.tangosol.examples.coherence.DBCacheStore < / class name >
    < init-params >
    < init-param >
    java.lang.String < param-type > < / param-type >
    * < {cache name} param-value > < / param-value > *.
    < / init-param >
    < / init-params >
    < / class-system >
    < / dumps-plan >
    < / reading-writing-support-map-plan >


    Thank you very much

    Published by: jetq on June 24, 2009 18:26

    Hi Frank,.

    In the example, the '{cache-name}' is supposed to be replaced by a table name or view of data that is queried for the cached data. Its purpose is show how to pass parameters to the constructor of class.

    Kind regards

    Harv

  • How to use the node to call a library function to convert C++ source codes

    Hi all

    There are two dll name 'QMSL_WLAN_Transport.dll' and 'QCAMSL_MSVC10R.dll' and some codes c ++ to connect to the DUT. The two DLLs work together for communicaite with the DUT.

    I am confused as how to use the node to call a library function to load the 'QCAMSL_MSVC10R.dll' function as

    g_hResourceContext = QLIB_ConnectServer_UserDefinedTransport((HANDLE) USER_HANDLE,
    UserDefinedSend,
    UserDefinedReceive,
    UserDefinedFlushTxRx,
    true,
    true);
    

    It seems that 'UserDefinedReceive, UserDefinedSend, UserDefinedFlushTxRx' Processaddress?  And "UserDefinedReceive, UserDefinedSend, UserDefinedFlushTxRx"'s functions in 'QMSL_WLAN_Transport.dll '.

    UserDefinedReceive = (_UserDefinedReceive)GetProcAddress(hUDT,"UserDefinedReceive");
    UserDefinedSend = (_UserDefinedSend)GetProcAddress(hUDT,"UserDefinedSend");
    UserDefinedFlushTxRx = (_UserDefinedFlushTxRx)GetProcAddress(hUDT,"UserDefinedFlushTxRx");
    

    Attached DLLs and C++ code snippets.

    Need help.

    Thank you.

    These parameters are reminders - pointers to functions that are called by the DLL - and there is no way to duplicate this purely in LabVIEW. Search this forum for the word "recall" and you will find similar questions (for other DLLs). You will need to write your own DLL (in C, C++, etc.) that implements these functions and provides a way to transfer data to LabVIEW.

  • Runtime error example NOR-DAQmx ANSI C in the Windows 7 virtual machine

    I am under a guest Windows 7 system with a host of Ubuntu 14, using VirtualBox and have encountered a problem running even the simplest examples provided by National Instruments, using the ANSI C API for NOR-DAQmx.

    The first time that the DAQ hardware is turned on, I can run a single measure, and after that, any other indicator displays the following error message:

    Attempted to read samples that are no longer available.
    The requested sample was previously available, but has since been overwritten.
    Increasing the buffer size, reading the data more frequently, or specifying
    a fixed number of samples to read instead of reading all available samples
    might correct the problem.

    Property: DAQmx_Read_RelativeTo
    Corresponding Value: DAQmx_Val_CurrReadPos
    Property: DAQmx_Read_Offset
    Corresponding Value: 0

    Task Name: _unamedTask(0)
    Status Code: -200279

    In order to start a new measurement, I have to restart the DAQ hardware, probably in order to clear the internal buffers that are in the process of substitution.

    I am interested in a measure of continuous tension in basic by using a callback function. (The example of ContAcq_IntClk provided by OR)

    The exactly the same setup, same version of NOR-DAQmx (9.7.5) and running on Visual Studio 2012 smoothly on a computer that is running Windows 7 directly.

    I suspect that the problem is with the internal buffer being somehow messed up because of the connection with the Virtual Machine, but do not find an elegant solution to fix it.

    The camera I use is NI USB-6289.

    Hello fromm8

    Thank you very much for your help, I managed to locate the problem.

    He was not the actual code, or something like that, it was a problem of communication between the VirtualBox machine and the physical device.

    Kept launches MAX test panels a comparable as error the program C.

    I fixed the problem by opting for VMWare, which seems to have the best compatibility with USB devices.

    See you soon!

  • Installation of the minimum runtime for the program using the driver USB of NI-VISA personal

    I have a LabVIEW 2009 application that uses a driver for a USB device, created using the wizard of the Driver NI-VISA.  What my minimum installation of runtime needed to understand when I move it on a non-development machine?

    On my dev machine, I went to MAX and given my new camera USB one alias of VISA.  I think I'll meet trouble if my deployment includes no MAX on TIME machine.

    Right now, I guess the minimum is LabVIEW 2009 DURATION, NOR-DAQmx Configuration (including MAX) execution, duration of NI-VISA.

    If not, is there a method that avoids having to configure an alias altogether?  It would be nice to not not need NOR-DAQmx, I use not any material that my USB device with driver custom.

    Thank you!

    Not sure why you consider same installation DAQmx. You can install just MAX, the VISA duration and your harware MAX configuration. The installerallows of LabVIEW allows you to export the configuration, and then you select the option to import on the deployment computer. You will also need to include the installation of the inf file you created with the wizard.

  • Using the driver of neslab instruments?

    Hello!  I'm trying to control my neslab w water cooler / Labview 8.6, and I noticed that there is an available instrument (pilot not-NOR).  Anyone used this before vi?  If so, help me to find a way to specify the port number?  The vi expects a digital port number, but I didn't know that com ports had digital specifications, only COM1, COM2, etc..  If anyone has an idea how to specify this, it would be a great help!  Thank you!

    Matt

    We have a few coolers Neslab, but used berever the driver, and if I remember well in the old days 0 = COM1, 1 = COM2, etc..

    Give it a try, nothing is damaged with the wrong number.

    -AK2DM

  • FireWire Camera disappeared to MAX when you select the driver NOR-IMAQdx

    Hi, as the title suggests, I'm having a problem getting my camera firewire (a PixeLINK PL-A742) appears in MAX so I can use it in my application. First of all, a bit of history.

    It was all works fine on an old computer (Windows XP SP3, LabVIEW 8.6.1, NOR-IMAQdx 3.2).

    We just received two new computers. They have Windows 7 Professional 64 - bit installed on them, then we are stuck using that (I was going to install labview in XP Mode, but there is no support for firewire, which no longer works). After finally getting installed labview (to run the setup.exe from Distributions\LabVIEW-ENG\LabVIEW861\, rather than make the autorun) we cannot get this camera to work. It works very well with the PixeLINK pilot (and Capture OEM program that accompanies it).

    So here is what I tried, and what happens when I do.

    (1) install cost of LabVIEW (including IMAQdx 3.2) and PixeLINK drivers.

    (2) at this stage, the camera works very well in the PixeLINK application

    (3) start MAX. It detects the camera and shows under devices NOR-IMAQdx. When you click on the camera, it informs me that the selected device is not currently associated with legacy OR-IMAQ driver IEEE or the driver OR-IMAQdx. This is perfect, it is supposed to do.

    4) click camera > driver > choose NOR-IMAQdx IIDC camera digital

    (5) he then disappears from MAX (no record OR-peripheral IMAQdx more). If I goto windows Device Manager, it comes under National Instruments IMAQ Interfaces as NOR-IMAQdx IIDC camera, says the pilot did get properly, it just does not appear in MAX more...

    (6) at this point, there is nothing I can do to get it back to the MAX (except in Device Manager to switch the driver on the PixeLINK one, then he pops up and we return to step 3)

    So, any ideas? This could be a problem with firewire interface and not the camera? I use the FireWire on my computer. It presents itself as Texas Instruments 1394 OHCI compatible host controller in Device Manager.

    Here are a few screenshots to help illustrate my problems.

    It is the initial configuration using the PixeLINK driver.

    It's MAX with the PixeLINK driver

    As soon as I click on the NOR-IMAQdx IIDC camera, it disappears

    And here's what it looks like in Device Manager after you have selected the NOR-IMAQdx driver

    Anyone have any ideas? I'm open to anything. At this point, I'm completely at a loss to know what to do.

    Thanks in advance,

    Devin

    Mechanical engineering intern

    University of Victoria

    Well, you can just ignore this message now. I solved my problem. I installed Vision Acquisition software 2009 and it seems to have solved my problem.

Maybe you are looking for