Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. can threading is way in finding co-ordinate?

can threading is way in finding co-ordinate?

Scheduled Pinned Locked Moved C#
algorithmsquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    montu3377
    wrote on last edited by
    #1

    Hi, I want to find out the exact location ,size and co-ordinate of line in the Page so can Multi-threading is also a way and if multithreading is the way then how it is possible? i know that suppose there is a word document and i am writing any thing word is checking my spelling (called spell check),here there is two simultanious thread is working one is searching co-ordinate and another is checking the spelling so in my application also i use multithreading concept? this is my theoritical assumption but does it work practically? regards, montu3377

    D 1 Reply Last reply
    0
    • M montu3377

      Hi, I want to find out the exact location ,size and co-ordinate of line in the Page so can Multi-threading is also a way and if multithreading is the way then how it is possible? i know that suppose there is a word document and i am writing any thing word is checking my spelling (called spell check),here there is two simultanious thread is working one is searching co-ordinate and another is checking the spelling so in my application also i use multithreading concept? this is my theoritical assumption but does it work practically? regards, montu3377

      D Offline
      D Offline
      DougW48
      wrote on last edited by
      #2

      Multithreading might not be the best implementation technique simply for determining the row and column numbers of your cursor. While it is nice to think of a thread as running concurrently with your main thread, in reality, they are still sharing processing space. If you do want to create a multithreaded application, then there are a few methods of going about this, some good, some really bad. First, you can start your thread when the application starts, and loop through it, constantly checking the cursor location. I think you'll find this is the worst approach you can take, as your thread will be interfering with your main application (and really you don't want a user to know it's even running.) Another approach would be to run a thread each time an event occurs which would possibly change the cursor location (such as a key press, or a mouse click.) These event handlers can simply start a thread, which handles finding the cursor location, and displaying it in your status bar (or wherever you want it.) This is better than the first approach, but I think an even better implementation would be to start one thread to check the cursor location, have it wait until an event is triggered, check the cursor, then go back into its waiting state until the next event is triggered. This way you don't have the overhead of constantly creating new threads to do the same task. Since this is purely a reader thread, I don't think you'll need locking mechanisms, but do a little research on it. If you do need to lock out the main thread, then you really aren't gaining much improvement over just calling a regular function when your events are fired. Good luck - Doug

      M 1 Reply Last reply
      0
      • D DougW48

        Multithreading might not be the best implementation technique simply for determining the row and column numbers of your cursor. While it is nice to think of a thread as running concurrently with your main thread, in reality, they are still sharing processing space. If you do want to create a multithreaded application, then there are a few methods of going about this, some good, some really bad. First, you can start your thread when the application starts, and loop through it, constantly checking the cursor location. I think you'll find this is the worst approach you can take, as your thread will be interfering with your main application (and really you don't want a user to know it's even running.) Another approach would be to run a thread each time an event occurs which would possibly change the cursor location (such as a key press, or a mouse click.) These event handlers can simply start a thread, which handles finding the cursor location, and displaying it in your status bar (or wherever you want it.) This is better than the first approach, but I think an even better implementation would be to start one thread to check the cursor location, have it wait until an event is triggered, check the cursor, then go back into its waiting state until the next event is triggered. This way you don't have the overhead of constantly creating new threads to do the same task. Since this is purely a reader thread, I don't think you'll need locking mechanisms, but do a little research on it. If you do need to lock out the main thread, then you really aren't gaining much improvement over just calling a regular function when your events are fired. Good luck - Doug

        M Offline
        M Offline
        montu3377
        wrote on last edited by
        #3

        Hi, Yeah great.Here i really like urs second approach in which one thread is start to determine the co-ordinate location and another theard is getting the related co-ordinates or do some thing into event but here we can't use event becoz event is never been fired in whole process as user will not do any thing on the image,not even click the image and not even key pressing. so i think here we can stuck in approach. yeah but if you have done this kind of some thead applicaiton which will do same kind or related kind of applicaton then pls. send it some code so i can understand the things and naturally i am also doing research on the same thing as much as possible but if u have some sort of code then pls. provide me which increase my confidance level to implement the module. thanks again. regards, montu3377

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups