Is it a bad idea to use Task.Delay() in a polling function?

Is the following a bad idea considering the expense of Task.Delay()?
async void WatchDog()
while(!bDisposed)
//check some things
await Task.Delay(100);
Hong

I've not used the DispatcherTimer, so I can't say anything from experience about how efficient it is or not. The few times I needed this sort of functionality in the few WPF apps I've done, I've used Task.Delay() ... I agree that it is certainly
a handy option. Most of my polling-type of work has been in non-UI situations (Windows Services), creating my own threading (and using Thread.Sleep()).
Ah, WinRT ... didn't know that was the platform you're writing for.
I've got no experience with WinRT. I don't know if there's a separate MSDN forum for that, the only thing I could find was a forum for Surface (https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=surfaceappdevelopment),
but I don't know if posting questions there would help you or not. Probably the WPF forum would work just as well (https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=wpf).
~~Bonnie DeWitt [C# MVP]
http://geek-goddess-bonnie.blogspot.com

Similar Messages

  • Is it a bad idea to use Time Capsule to access my iTunes music?

    I'm thinking about putting all of my music on my time capsule and making iTunes access it through that.
    Is this a bad idea for any reason? I'm thinking that there could be a few seconds of delay when playing a song or something, which I don't really mind.
    The other thing I thought is that this could be bad because if my Time Capsule fails, then I lose my music, whereas if I store my iTunes music folder on my computer, it will be backed up by Time Machine, and therefore be in 2 safe locations instead of 1.
    Anybody have any thoughts/suggestions?

    Csound1 wrote:
    Roger Wilmut1 wrote:
    Csound1 wrote:
    That was going to be my riposte,
    You should have posted your riposte post-haste, not post- the posted riposte post that just passed.
    There you go again, my head spins
    But who is on third!?!?!?!?!!?!?!?!?

  • Is it a bad idea to use NVIDIA's "reference driver"?

    Boot Camp set up my iMac with NVIDIA GeForce GT 640M graphics card with driver version 332.28.  NVIDIA has a "reference version" of 334.89.  Since the 640M is of course a mobile chipset they do not provide drivers for it (I never understood why this was) but rely on the manufacturer however they now apparently put out these "reference drivers".  Do you think this is worth a shot?  Has anyone tried them?

    No, it's not a bad idea.
    I heard that in the past years Apple locked the driver from easy updating, but now you can just update as with every other PC.
    For exampe, with Apple stock driver (as of early 2013, I have the GT650M) Battlefield says that I could have problem.
    I always updated and everything worked fine (even if I had a lot of problem with Boot Camp and Windows).
    The update mantains the overclock of the card (as some cards are overclocked by Apple).
    Sorry for my english.

  • Is it a bad idea to use a single read only Connection?

    I am developing a client/server application, where each client request executes in a separate thread. Currently i create a new Connection object for ANY database access. I am wondering if there is any advantage changing this, to use a single Connection object for read only access, but still creating new Connection objects for read/write access.
    Does anyone have any opinions on this matter?
    I am aware that if i go with this approach, and someone causes a SQL exception on the read only connection that it will be closed. Right now this appears to be the main disadvantage to this approach.

    I don't like the single, read-only connection idea.ack
    A single connection throughout the execution of the
    application has several security disadvantages. It is
    also less scalable. I've read other problems
    associated with it but I none come to mind at the
    moment.What are the security implications that you speak of?
    I think for the type of application i am developing,database security is not a concern, as all users are able to access the same tables.
    Basically in our application, the security is in the application domain, not the database.

  • What's the idea from using one of the Tasks a common cost "Capitalization"?

    Hi,
    I want to know What is the idea behind using on of the costs included in the work breakdown structure as a common cost as a group level?!!
    and Shouldn't i include it in any transaction?!!!(i.e. don't use it in the PO, AP invoices....etc?).
    Please i need clarification,
    Thanks in advance.

    Hi
    In any project there could be some type of shared cost, that may be associated with a project as a whole, but it would not be practical to allocate such common cost to each one of the individual tasks.
    For example, a construction project will have a task for foundation, plumbing, electric wiring, etc. The project manager, and construction inspector are resources common to all those tasks, and it may be costly to try and allocate directly the hours of those resources to each one of the tasks.
    Dina

  • TS1702 New i phone maps, is backwards, there is no way you can use this app now. bad idea to launch something without doing more research.

    this app you cannot use now, bad idea before releasing it.

    It takes two sides to agree, I seriously doubt it was ever going to happen. Or they have demanded some outlandish amounts as they are trying to do with Motorola Mobility patents.
    I honestly don't think there is anything wrong with the app, there is a lot wrong with the geobase from TomTom. And I'm sure it will be fixed, just like Google Maps was. Do you remember when it was first released?

  • MAX(SummaryNum) +1 bad idea, but how to use sequence part composite column

    Hi,
    My relational mode is as follows
    Policy (policynum PK) has 1:M with Summary (policynum FK, SummaryNum part of PK, other columns part of PK)
    Basically for each policy users can enter notes with SummaryNum 1, 2, 3, 4.... These numbers are shown to the user for tracking purpose. I need to make sure summary notes for EACH policy start with 1 (cannot really use sequence in the table in the strictest sense) and are incremented by 1. The current Oracle form basically creates the next highest possible value of SummaryNum by adding one to the currently available highest value. In brief, it is like a sequence number for summaries of a particular policy in the summary table.
    PRE-INSERT
    SELECT MAX(SummaryNum ) + 1
    FROM Summary
    I am trying to replicate this in ADF BC (using 11g) and know that not using sequencing and adding one to get the next number is a very bad idea due to concurrency challenges (transactional ACID properties). The reasons are as follows.
    •     Using MAX(policy_memo_seq_num) + 1 is not scalable,
    •     It will lead to duplicates in a multi-user environment, whether ADF BC, Oracle Forms, or any other technology
    I also know how to use create a sequence in db, a related trigger, and then set the attribute in EO properties as DBSequence. My challenge is that since SummaryNum is not a primary key, and instead is part of a composite key in my case, how do I make sure that summary notes for EACH policy start with 1 in the Summary Table.
    I appears that i cannot really use sequence in the table in the strictest sense as this will mean that for policies the summaryNum will start from the next available sequence number, but what i really want is to have it start by one for all policies.*
    I would appreciate any help.
    Thanks,

    Not sure if there is a better way, but here is one way. Let's say your table was like this:
        SQL> desc versioned_item
         Name         Null?    Type
         ID           NOT NULL NUMBER
         VERSION      NOT NULL NUMBER
         DESCRIPTION           VARCHAR2(20)and lets say your data looked like this:
        SQL> select * from versioned_item order by id, version
                ID    VERSION DESCRIPTION
              1001          1 Item 1001
              1001          2 Item 1001
              1001          3 Item 1001
              1002          1 Item 1002
              1002          2 Item 1002
              1003          1 Item 1003To select only the rows for the max-version-id, you could do this:
        select id, version,description
        from versioned_item
        where (id,version) in (select id,max(version) from versioned_item group by id)
        order by id
                ID    VERSION DESCRIPTION
              1001          3 Item 1001
              1002          2 Item 1002
              1003          1 Item 1003To capture this as a view object, you'd only just need to paste in the WHERE clause above into the Where clause box of the view object. No need to use expert-mode since you're not changing the select list or from clause.

  • Bad Idea: Making default behavior of "built in mouse wheel support" set to on key focus

    This is just a little rant....
    I love new features in Labview, but setting them to be on automatically when they can generate unexpect behaviour is really a bad idea. We recently moved from 2012 to 2013. Suddenly, I have users saying "values are changing and I don't know why". Turns out they were changing a value in a numeric, then attempting to scroll away. Why on earth would NI make this the default behavior??? Luckly for us the value change wasn't too bad but I could think of a few places that a sudden, unplanned change in a numeric could have ruined an experiment.
    Off to do alot of work to undo this....

    RTSLVU wrote:
    I have noticed this too, but I swear long before 2013.
    You should not have to scroll around a user interface to begin with.
    If you can not fit a user interface on one screen of the target machine it's time to rethink your interface.
    I suggest dividing things up by task and using a tab control.
    and this is why I now hate posting in this forum.....
    People just love to tell you how you should be doing something, and not focusing on the topic of the thread. If everyone is going to get stuck on the "UI's should not have scroll bars" soap box, see the attached screen shot. This problem arose from a settings pop-up dialog. I could have used tabs, but in this case it makes more sense for the users to move top to bottom in a linear fashion through the process they are setting up.
    My point in all this is why would NI make this the default behavior? I like the feature, but it should have been something that a designer has to actively turn on.
    Attachments:
    settings screen.PNG ‏181 KB

  • Reasons for not deploying applications using Task Sequence

    Hi guys!
    Could you provide me with some reasons why I shouldn't be using Task Sequences to deploy all of my applications? I like the idea that I can deploy multiple applications and packages at the same time, as well as being able to perform other tasks in the same
    Task Sequence if needed. I also really like the progress bar window which shows end user the company and name of application being installed.
    The SCCM Unleashed 2012 book mentions that while this is an available option it's not a good practice because "applications are meant to be state-based". Would someone be able to elaborate on that statement?
    Is using Task Sequences for deploying applications generally a bad practice that I should try to avoid?

    Hi,
    here is a description for state based:
    Depending on the deployment purpose you have specified in the deployment type of an application, System Center 2012 Configuration Manager periodically checks that the state of the application is the same as its purpose. For example, if an
    application’s deployment type is specified as Required, Configuration Manager reinstalls the application if it has been removed. Only one deployment type can be created per application and collection pair.
    If you deploy your applications by using task sequence you bypass this feature. You will install the application. but after this initial installation there will be no further check for the app to be still present on device.
    You can use task sequences, but should be aware of the features you bypass in this scenario.
    Regards
    Eric
    Eric Berg -- http://www.ericberg.de -- MCSE: Private Cloud MCSE: Server Infrastructure MCSE: Desktop Infrastructure

  • Running a .cmd file at startup using Task Scheduler on Windows 2012 R2 server

    Hello,
    I've recently tried to get a simple .cmd file running at server startup on my Windows 2012 R2 server.
    The .cmd (test.cmd) file contains the following:
    C:
    cd C:\SomeFolder\
    call Some.exe file "Argument1" "Argument2"
    I've ensured that the local administrator user [someuser01] has full control of the C:\SomeFolder
    I've also ensured that someuser01 is part of Log on as Batch Job
    in Local Security Policy
    To try running it as startup, I tried using Task Scheduler.
    General Tab: I set the user (local administrator account [someuser01] ) and ticked the options
    Run whether logged on or not, Do not Store Password, Run with Highest Privileges
    Triggers: At System Startup, Ticked Enabled
    Actions: Start a Program. Program/Script: test.cmd, Add arguments: [Blank], Start in: C:\SomeFolder
    Conditions: Unticked all conditions
    Settings: Ticked only the following --> Allow task to be run on demand, If the running task does not end...force to stop
    Then I clicked OK and was prompted for someuser01's credentials.
    I then restarted the server.
    Upon logging in as administrator, I checked the task scheduler, and I found that the task did not run (Last Run Time: Never)
    I've been able to run it manually (click Run on the task in Task scheduler) without any problems.
    I just cannot get it to run at startup as I've instructed Task Scheduler to do.
    Any ideas on what might be causing this problem?
    Thanks.

    Hello Dave Patrick,
    I've also tried this approach and I came across this error after I try to enter someuser01's credentials:
    An error has occured for the task sometask01. Error message: The following error was reported: A specified logon session does not exist. It may already have been terminated..
    After doing some research, this new error is caused by a setting in Local Security:
    Local Security Policy --> Security Options --> Network Access: Do not allow storage of passwords and credentials for network authentication --> Enabled
    Unfortunately, I cannot disable this Security Policy due to our company's internal restrictions.
    Just to clarify, the reason that the task does not run at startup is because of a logon failure because the password was not stored for
    someuser01 ?
    However, I cannot allow storage of the password because of our our company's internal restrictions.
    Is there a possible workaround for this..?
    Thanks!

  • Why won't Firefox close, even using Task Manager, unless I right click on the process and select 'end process' ?

    Firefox works fine, but won't respond when I try to shut it down. Using Task Manager to 'End Task' doesn't work. In Task Manager I have to right click on firefox in the Processes menu and click 'End Task'. Apart from logging off/shutting down, this is the only method that works. Also refused to respond when I tried to reset and doesn't respond to commands to change profile settings.

    SOLUTION (possible).
    Hi all. I had this problem as well. I currently run FF26. A week or so ago, out of nowhere FF wouldn't exit - the window would close but firefox.exe process would keep running in the background using about 50% of CPU. Not sure if it's connected, but just prior to that I clicked on a link on Facebook that looked like spam website, nothing happened, site loaded (sort of, all I saw was a msg - Please Wait...) but nothing happened, I have Eset antivirus and it monitors network traffic and files for viruses, so maybe it prevented my PC getting infected...
    So, I had this problem for a few days, was searching the net for solutions, but nothing seem to help. Then, just out of luck I did something that WORKED!
    Here's what I did. I noticed that svchost.exe was using a lot of CPU alongside with FF. I ran ProcessExplorer to see what might be connected to this process, the list was long and I didn't have any idea where to start, so what I did was - Right click on svchost process, choose Debug and dismiss the warning. In a few seconds svchost process quit and after that FF started closing properly.
    I had to re-enable all my plugins and themes I disabled prior, I also lost my history and preferences which I trashed in the process of searching for solution. But heck, it worked, hopefully for good. Now if someone could point out the real cause of this and fix it for everyone - that would be great. Cheers!

  • What is badi and where used?

    Tell me about badi and its uses in abap?
    Thanks.

    Hi
    BAdi's are used as similar to user exits for most of the transactions using OOPS concepts
    DEFINING THE BADI
    1) execute Tcode SE18.
    2) Specify a definition Name : ZBADI_SPFLI
    3) Press create
    4) Choose the attribute tab. Specify short desc for badi.. and specify the type :
    multiple use.
    5) Choose the interface tab
    6) Specify interface name: ZIF_EX_BADI_SPFLI and save.
    7) Dbl clk on interface name to start class builder . specify a method name (name,
    level, desc).
    Method level desc
    Linese;ection instance methos some desc
    8) place the cursor on the method name desc its parameters to define the interface.
    Parameter type refe field desc
    I_carrid import spfli-carrid some
    I_connid import spefi-connid some
    9) save , check and activate…adapter class proposed by system is
    ZCL_IM_IM_LINESEL is genereated.
    IMPLEMENTATION OF BADI DEFINITION
    1) EXECUTE tcode se18.choose menuitem create from the implementation menubar.
    2) Specify aname for implementation ZIM_LINESEL
    3) Specify short desc.
    4) Choose interface tab. System proposes a name fo the implementation class.
    ZCL_IM_IMLINESEL which is already generarted.
    5) Specify short desc for method
    6) Dbl clk on method to insert code..(check the code in “AAA”).
    7) Save , check and activate the code.
    Some useful URL
    http://www.esnips.com/doc/e06e4171-29df-462f-b857-54fac19a9d8e/ppt-on-badis.ppt
    http://www.esnips.com/doc/10016c34-55a7-4b13-8f5f-bf720422d265/BADIs.pdf
    http://www.esnips.com/doc/43a58f51-5d92-4213-913a-de05e9faac0d/Business-Addin.doc
    http://www.esnips.com/doc/1e10392e-64d8-4181-b2a5-5f04d8f87839/badi.doc
    www.sapgenie.com/publications/saptips/022006%20-%20Zaidi%20BADI.pdf
    http://www.sapdevelopment.co.uk/enhance/enhance_badi.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/04/f3683c05ea4464e10000000a114084/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/e6/d54d3c596f0b26e10000000a11402f/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c2/eab541c5b63031e10000000a155106/frameset.htm
    Now write a sample program to use this badi method..
    Look for “BBB” sample program.
    “AAA”
    data : wa_flights type sflight,
    it_flights type table of sflight.
    format color col_heading.
    write:/ 'Flight info of:', i_carrid, i_connid.
    format color col_normal.
    select * from sflight
    into corresponding fields of table it_flights
    where carrid = i_carrid
    and connid = i_connid.
    loop at it_flights into wa_flights.
    write:/ wa_flights-fldate,
    wa_flights-planetype,
    wa_flights-price currency wa_flights-currency,
    wa_flights-seatsmax,
    wa_flights-seatsocc.
    endloop.
    “BBB”
    *& Report ZBADI_TEST *
    REPORT ZBADI_TEST .
    tables: spfli.
    data: wa_spfli type spfli,
    it_spfli type table of spfli with key carrid connid.
    *Initialise the object of the interface.
    data: exit_ref type ref to ZCL_IM_IM_LINESEL,
    exit_ref1 type ref to ZIF_EX_BADISPFLI1.
    selection-screen begin of block b1.
    select-options: s_carr for spfli-carrid.
    selection-screen end of block b1.
    start-of-selection.
    select * from spfli into corresponding fields of table it_spfli
    where carrid in s_carr.
    end-of-selection.
    loop at it_spfli into wa_spfli.
    write:/ wa_spfli-carrid,
    wa_spfli-connid,
    wa_spfli-cityfrom,
    wa_spfli-deptime,
    wa_spfli-arrtime.
    hide: wa_spfli-carrid, wa_spfli-connid.
    endloop.
    at line-selection.
    check not wa_spfli-carrid is initial.
    create object exit_ref.
    exit_ref1 = exit_ref.
    call method exit_ref1->lineselection
    EXPORTING
    i_carrid = wa_spfli-carrid
    i_connid = wa_spfli-connid.
    clear wa_spfli.
    Check this link to learn more about differences between user-exits and badis:
    http://www.sap-img.com/abap/difference-between-badi-and-user-exits.htm
    <b>Difference Between BADI and User Exits</b>
    Business Add-Ins are a new SAP enhancement technique based on ABAP Objects. They can be inserted into the SAP System to accommodate user requirements too specific to be included in the standard delivery. Since specific industries often require special functions, SAP allows you to predefine these points in your software.
    As with customer exits two different views are available:
    In the definition view, an application programmer predefines exit points in a source that allow specific industry sectors, partners, and customers to attach additional software to standard SAP source code without having to modify the original object.
    In the implementation view, the users of Business Add-Ins can customize the logic they need or use a standard logic if one is available.
    In contrast to customer exits, Business Add-Ins no longer assume a two-level infrastructure (SAP and customer solutions), but instead allow for a multi-level system landscape (SAP, partner, and customer solutions, as well as country versions, industry solutions, and the like). Definitions and implementations of Business Add-Ins can be created at each level within such a system infrastructure.
    SAP guarantees the upward compatibility of all Business Add-In interfaces. Release upgrades do not affect enhancement calls from within the standard software nor do they affect the validity of call interfaces. You do not have to register Business Add-Ins in SSCR.
    The Business Add-In enhancement technique differentiates between enhancements that can only be implemented once and enhancements that can be used actively by any number of customers at the same time. In addition, Business Add-Ins can be defined according to filter values. This allows you to control add-in implementation and make it dependent on specific criteria (on a specific Country value, for example).
    All ABAP sources, screens, GUIs, and table interfaces created using this enhancement technique are defined in a manner that allows customers to include their own enhancements in the standard. A single Business Add-In contains all of the interfaces necessary to implement a specific task.
    The actual program code is enhanced using ABAP Objects. In order to better understand the programming techniques behind the Business Add-In enhancement concept, SAP recommends reading the section on ABAP Objects.
    What is difference between badi and user-exists?
    What is difference between enhancements and user-exists? and what is the full form of BADI?
    I have another doubt in BDC IN BDC WE HAVE MSEGCALL (i did not remember the > correct name) where the error logs are stored, MSEGCALL is a table or structure.
    <b>Difference between BADI and USER-EXIT.</b>
    i) BADI's can be used any number of times, where as USER-EXITS can be used only one time.
    Ex:- if your assigning a USER-EXIT to a project in (CMOD), then you can not assign the same to other project.
    ii) BADI's are oops based.
    Reward points for useful Answers
    Regards
    Anji
    Message was edited by:
            Anji Reddy Vangala

  • When I upgraded to ios6 (Bad idea!)  I lost my pictures,  how can I restore them?

    When I installed iOS 6 (bad idea,). I lost all pictures.  How can I restore them?
    Aamunrud

    assuming you didn't/don't use photostream I need a couple things cleared up first... did you back up your phone before updating to iOS 6 and if you did, was it on a PC or Mac?

  • What's with the new Firefox 8.0? I made the mistake of updating mine and about 30% of the icons in bookmarks disappeared. It looks like you are requiring a favicon. Anyway, BAD IDEA!!!!!

    What's with the new Firefox 8.0? I made the mistake of updating mine and about 30% of the icons in bookmarks disappeared. It looks like you are requiring a favicon. Anyway, BAD IDEA!!!!!

    Briansyddal - you might be able to manage your phone without a PC, but many of us can't, especially those of us with large iTunes libraries.  How do you propose I manage my 250GB of music using only a phone?  Maybe I could go out and buy 10 iPhones and spread my library out among them!
    Catz537 - I have the same problem as you and I've spent hours on the web trying to find a solution to it.  It was a problem with iOS 7 and  8.1.1 doesn't fix it.  The the only advice from Apple is completely useless because it requires you, effectively, to delete and recreate your iTunes library and lose all your metadata, album art, notes etc and there's also no guarantee it will work.   I wish I could be more help (even more - I wish Apple could be more help) - I updated to 8.1.1 at 1400 today.  At 2200 I'm still "waiting for changes to be applied" for a measly 16GB of music transfer. 

  • Distributed encoding of referenced movies --bad idea?

    Distributed encoding of referenced movies (using Compressor) --is this a bad idea? If you do this routinely and it works for you, please let me know.
    Thanks,
    Cris

    Nebraska,
    Thanks for your reply. I am trying a home network to see if I can cut down my encoding time and increase my capacity on existing equipment. What I have is outlined in "other details" below. Because of the limitations, I am putting highest priority on trying to find out what has been causing problems with my real time mp2 transcoder nor recoginizing some Quicktime files and consider the Qmaster distributed processing for batch processing files for web streaming. For now, thtis will have to do.
    I see the sense of having a dedicated server for the source footage. But I need to do things peer to peer. I use to oversee a WinNT server years back. Its been awhile. Do you would log into each of your G5 quads as the same domain user (or Mac OSX server equivalent)? Is one of your G4's (not the server) the controller? Is the same machine both controller and client?
    For the referenced movie I tried, it took many many hours --at least several times longer than if I did the job on a single machine. However, that was when I only had a cluster of two. I might try again with three.

Maybe you are looking for

  • Creative mp3 accessor

    >I am looking at the c and I can find much for in car devices like ?all in one holders?. Belkin to a fantastic range for the ipod but yet im finding it hard to get something that is designed for any creative mp3 player! If anyone could let me know if

  • Ipod hooked up; not showing on desktop or in itunes

    As of today, I'm having problems with my MacBook recognizing my ipod nano 2G. I've already tried the 5 R's and all that, but nothing is working. Suggestions?

  • How to create/track a pallet exchange program

    I would like to know the best/easiest way to track a pallet exchange program in SAP. Right now, what we are doing is: 1. we created a material for pallets 2. when we ship pallets, we bill the customer 3. if they send them back, we issue a return orde

  • More capability than available in iDVD

    I would like a little more capability than is available in iDVD -- more themes; more transitions; etc. What is the next step up in software? Also is there something that burns DVDs faster? Being a grandparant, I just burned a DVD with movies and phot

  • Error While maintain VK11 Create Condition Type

    Dear All      Due to I created new sale area in system and user want to maintain condition type "MWST" for new sale area . In config I set criteria for maintain condition type "MWST" is Sale Org / Channel /Division      When I access tcode VK11 for s