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. C# Threading

C# Threading

Scheduled Pinned Locked Moved C#
csharpalgorithmsdata-structuresquestion
2 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.
  • R Offline
    R Offline
    Ramkithepower
    wrote on last edited by
    #1

    Hi , I am trying to create an application to extract some txt files from ZIP and then search the text files for a search string. I have done two functions 1. That extracts the files 2. That searches through the files This is my required program flow. I need to threads to run here The first thread should concentrate on searching the file, extracting them and add the extracted files's to a string array and the second thread to monitor that string array and search the newly added files for the search string. Is this possible? I have done some coding for this. Will post it later in this message thread if required later.

    Jack Sparrow -------------------------------------- Defeat is not the worst of failures. Not to have tried is the true failure.

    P 1 Reply Last reply
    0
    • R Ramkithepower

      Hi , I am trying to create an application to extract some txt files from ZIP and then search the text files for a search string. I have done two functions 1. That extracts the files 2. That searches through the files This is my required program flow. I need to threads to run here The first thread should concentrate on searching the file, extracting them and add the extracted files's to a string array and the second thread to monitor that string array and search the newly added files for the search string. Is this possible? I have done some coding for this. Will post it later in this message thread if required later.

      Jack Sparrow -------------------------------------- Defeat is not the worst of failures. Not to have tried is the true failure.

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      Ramkithepower wrote:

      Is this possible?

      Yes - I'm not sure it's the best possible design, but it is possible. What you could do (if you are using .NET 3.5 or later) is use an ObservableCollection in the first thread which the second thread hooks into the event handlers for to see when items are added into that collection - then it can perform it's searching in response to the item changing. Alternatively, and this is perhaps a better method, you could have your first thread implement an event handler that takes the contents of the file as a parameter (assuming you are just storing it as a big string here) and the second thread hooks into that event. Obviously, you'd fire off the event every time you added a file.

      I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be

      Forgive your enemies - it messes with their heads

      My blog | My articles | MoXAML PowerToys | Onyx

      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