[ETA: posted in wrong forum, sorry! will repost in relevant forum] reading samples: critical section atomicity?

Hello all,
I have the following situation:
- one thread (T1) is constantly reading samples from a NI USB 9229 in a local buffer and copying them an array A (44100Hz)
- another thread (T2) is waiting for a command and subsequently copying a batch of 44100 samples from A to a local array variable and doing some computation with them
- array A is protected in a critical section (T1 and T2 enter the critical section when working with A directly and leave it afterwards)
How "atomic" is the reading of samples from the device in my array A? I.e., is it guaranteed that the critical section protection on A means that by the time T2 accesses A, T1 has finished writing 44100 samples in it?
Or do I have to register with DAQmxRegisterEveryNSamplesEvent() a callback which 1) reads 44100 samples, 2) notifies T2 that the batch is complete and available?
Thank you in advance!
Message Edited by acgrama on 02-08-2010 08:30 AM
Solved!
Go to Solution.

As far as I can understand the situation, the answer should be 'yes': the array is protected until you leave the critical section.
But could I suggest an alternative, perhaps simpler approach?
If you configure a thread safe queue of 44100 elements which discards old elements, with T1 that fills it on top, T2 can freely read from the queue without disturbing T1, having available the most recent set of data in any moment.
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos?

Similar Messages

  • Sorry if I'm posting in wrong forum - Toast 10 video conversion...slow

    I appologize for posting in this forum, but I cannot find a "Toast" forum. I am using a 12 core MacPro. I use Toast 10 to convert movies onto DVD. It takes hours to convert a DVD in certain formats. Does anyone have a better idea of software to use? Thanx in advance.

    A Toast Forum would of course be on the Roxio website.
    Try http://forums.support.roxio.com/forum/213-toast-10/?s=cd18ec2a145baa56a267279984 214153

  • Re: Question posted in wrong forum - How to move ?

    I just realised that I posted a question in the wrong forum. Is there a way that I can move it, or should I rewrite it in the correct forum ?
    Thank you

    I think only the moderator would be able to move a thread.
    Ive got only one option available: create a post I think youve got also only this one option.

  • Posted in wrong forum

    wrong forum, sorry
    Edited by: CC on Oct 31, 2008 4:56 PM

    Just to check one possibility, the playlists in which you're having problems aren't Smart Playlists, are they? Smart Playlists can be identified by the purple icon with the "gear" symbol; manual playlists are blue with a note symbol. You can't manually rearrange items in a Smart Playlist.
    This may not be the case for you, but I wanted to eliminate that possibility before we look at other options.
    Regards.

  • Penalties for posting in wrong forum ?

    Wouldn't it be nice if we could give a penalty (negative Duke Dollars) to those people that post there issues in the wrong forum?

    The BBC has a knowledge game show called "The Weakest Link" ( http://www.bbc.co.uk/weakestlink/ ) where players must vote against each other every round until two players remain.
    But then again, a forum is not a fighting pit but a place for sharing knowledge.
    Maybe this forum is the wrong forum for my post indeed, but I noticed that this forum attracts a lot of wrong addressed posts. (The name of) this forum seems to attract newbies that haven't heard of Generics in the sense of JSR14.
    Come to think of it, since we are dealing with newbees we should not be too harsh on them and should guide them to find the right place for their question. I posted a request in an appropriate forum: http://forum.java.sun.com/thread.jsp?forum=10&thread=501625

  • Just deleted the question posted in wrong forum

    thanks a lot!

    I think only the moderator would be able to move a thread.
    Ive got only one option available: create a post I think youve got also only this one option.

  • Sorry, posted in wrong forum

    I upgraded to ipod version 1.2.2, now after ejecting the ipod, I have no music listing on the ipod. Setting/About shows my capacity 27.8 gb and available 4.1 gb but still no listings in Music, Playlist, artist, albums or songs. When I reconnect the ipod, everything is there... Any ideas?
    Message was edited by: hopsdude

    Sorry, post in the wrong forum

  • Please delete my old post, posted in wrong forum.

    http://discussions.apple.com/message.jspa?messageID=12203394#12203394
    Have white macbook, not aluminum.

    I deleted your post.
    Thanks for letting us know!
    Pansy

  • Please ignore - posted in wrong forum (again!)

    Apologies.
    John.

    Just to check one possibility, the playlists in which you're having problems aren't Smart Playlists, are they? Smart Playlists can be identified by the purple icon with the "gear" symbol; manual playlists are blue with a note symbol. You can't manually rearrange items in a Smart Playlist.
    This may not be the case for you, but I wanted to eliminate that possibility before we look at other options.
    Regards.

  • Sorry posted my Query in a wrong forum

    sorry posted my Query in a wrong forum changed to java programming
    Message was edited by:
    vas_pol
    Message was edited by:
    vas_pol

    Thanks and sorry for the
    misplacement.
    Please take your question to the ipod forums. Choose whichever one the many on this page that fits your product.
    http://discussions.apple.com/category.jspa?categoryID=146

  • Wrong forum sorry

    sorry wrong forum.

    Start/Devices and Printers/ Right click on your printer, select Printing Preferences.  There you will find what you need.
    Say thanks by clicking the Kudos Thumbs Up to the right in the post.
    If my post resolved your problem, please mark it as an Accepted Solution ...
    I worked for HP but now I'm retired!

  • Sorry posted in wrong place

    sorry posted in wrong place
    Edited by: user636526 on Oct 28, 2008 11:49 AM

    chessyy,
    Sorry that you had this problem.
    The software coupons are pretty much useless unless Apple says they are worth something for a very specific reason. In your case they will be worthless.
    You do not tell us much about your iMac, but as you have 512-768M of RAM, 10-15% free Hard Drive space, and a 733-1GHz processor I would recommend that you Upgrade to Tiger. Be sure to read the iLife '06 System Requirements and Notes for your own edification.
    Tiger can be purchased at AppleRescue for $79.00.
    You can install it over iLife '06 using an Archive and Install. Software update will bring you to the latest version of Tiger.
    I will mention this last, but it really should be your first step...backup your important files.
    ;~)

  • Sorry wrong forum, and I can't find delete button.

    sorry wrong forum.
    Where is the delete button?

    lol i dont know if you can delete threads, but i imagine it would be under the 'Edit/Delete' part of the first post in a thread, ie ure one up there ^^ where u can change the title n stuff.

  • Sorry for posting a wrong question Loading multiple files!!

    Sorry for posting a wrong question Loading multiple files!!
    As per my understanding 
    Sorry for posting a wrong question Loading multiple files!!
    As per my understanding only a standard Dat file can be compared with one single dat file.Because Eacg dat file will be containing its own values. So multiple files cannot be compared.
    Am assuming dat files containing time(s) and acceleration values(g). G value for each file differs.
    Thanku!!
    Solved!
    Go to Solution.

    Hi Rash.patel,
    I'm still not sure I follow you.  When you say "Dat" file, do you mean the DIAdem 8.x standard file with the *.dat header and usuall a *.r64 binary file or two that it references, or do you mean some other specific data file with the extension *.dat or do you just mean a generic data file?
    DIAdem can certainly load multiple files into the Data Portal at the same time, so you must be referring to either a limitation of the "*.Dat" file you're talking about or correcting yourself that all the data you want to compare turns out to be in one "Dat" file.
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • Delete. wrong forum sorry

    delete wrong forum sorry

    lol i dont know if you can delete threads, but i imagine it would be under the 'Edit/Delete' part of the first post in a thread, ie ure one up there ^^ where u can change the title n stuff.

Maybe you are looking for

  • Af:serverListener on jspx page - compilation error - jDeveloper 11.1.1.4.0

    I have a weird problem that adding a serverListerner component on jspx page causes compilation error: The class of the deferred-methods return type "{0}" can not be found. No property editor found for the bean "javax.el.MethodExpression" If I remove

  • False File.exists; flex cannot open SQLite.db file

    I have a program that uses an SQLite database. Instead of creating and importing the database, the sqlite databse already exists, with the data. I am trying to open it and read the information (select* from table - for example); But nothing i do seem

  • Warrenty Is available in other country

    hello..! I have purchased i phone 4s from otherside my residential country. is warrenty for my iphone  available in my country (i.e. India)..?? please reply fast

  • No Boundary Event in Automated Activity

    Hello Experts, I am developing a BPM in PI 7.31 SP4. I want to add a boundary event in my Automated Activity but when I try to add it the pop up shows me no Options. I expected to have at least a TehcnicalError but there are no one. As you can see in

  • Using Photoshop as external editor

    On a 64 bit machine with the 64 bit version of LR installed, evoking Photoshop as external editor still incorrectly opens the 32 bit version of PS, not the 64 bit as used to happen with LR4. One can work around this if one remembers to open the 64 bi