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. .NET (Core and Framework)
  4. Access of common thread by WCF service and windows service in c#.net 3.0

Access of common thread by WCF service and windows service in c#.net 3.0

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharphelpwcfcareer
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.
  • A Offline
    A Offline
    anumadhu
    wrote on last edited by
    #1

    Hello, I am developing a windows service using the WCF technology(this contains the windows service and also hosts a webservice) in C#.net3.0. I am developing this on the windows XP platform. Here, i have two class files WCFservice.cs and WindowsService.cs. There is a single thread declared, started (in OnStart()) and Aborted(OnStop()) methods of the WindowsService.cs file. Now, my requirement is to, suspend() and resume() the same thread in the WCFservice.cs file. since, the WCFservice class is inherited from IWCFservice and WindowsService class is inherited from the ServiceBase class, i am unable to fix my problem of accessing the same threadObj from both these files. Can anyone help me here... Thank you Anee.. Anee

    T 1 Reply Last reply
    0
    • A anumadhu

      Hello, I am developing a windows service using the WCF technology(this contains the windows service and also hosts a webservice) in C#.net3.0. I am developing this on the windows XP platform. Here, i have two class files WCFservice.cs and WindowsService.cs. There is a single thread declared, started (in OnStart()) and Aborted(OnStop()) methods of the WindowsService.cs file. Now, my requirement is to, suspend() and resume() the same thread in the WCFservice.cs file. since, the WCFservice class is inherited from IWCFservice and WindowsService class is inherited from the ServiceBase class, i am unable to fix my problem of accessing the same threadObj from both these files. Can anyone help me here... Thank you Anee.. Anee

      T Offline
      T Offline
      Tristan Rhodes
      wrote on last edited by
      #2

      I think, you could, in the OnStart function that runs first, store a reference to the current running thread: Thread _currentThread; OnStart() { _currentThread = Thread.CurrentThread; } This should give you a handle to the current thread. You could then add the following code which can be invoked from a different thread: void Suspend() { _currentThread.Suspend() //Depracated - Use Alternative Threading Technique } void Resume() { _currentThread.Resume() //Depracated - Use Alternative Threading Technique } This isn't a good solution, but it's a rought template that might nudge you in the right direction. Alternatively, it may not be what you're looking for. :) Hope it helps anyway. Tris

      ------------------------------- Carrier Bags - 21st Century Tumbleweed.

      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