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 / C++ / MFC
  4. How do I safely shut down a thread, when I can't send a CEvent?

How do I safely shut down a thread, when I can't send a CEvent?

Scheduled Pinned Locked Moved C / C++ / MFC
questionsysadminhelp
3 Posts 3 Posters 10 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.
  • B Offline
    B Offline
    bbrown
    wrote on last edited by
    #1

    Hi, I'm working on making my own simple proxy server to learn a bit about socket programming. I'm also implementing the main loop as a seperate thread but since my CSocket.Accept(CSocket) call is in its own loop waiting for a connection, I can't send it a CEvent to shut down. Any help would be appreciated.

    M R 2 Replies Last reply
    0
    • B bbrown

      Hi, I'm working on making my own simple proxy server to learn a bit about socket programming. I'm also implementing the main loop as a seperate thread but since my CSocket.Accept(CSocket) call is in its own loop waiting for a connection, I can't send it a CEvent to shut down. Any help would be appreciated.

      M Offline
      M Offline
      Mike Dunn
      wrote on last edited by
      #2

      CSocket::CancelBlockingCall() will abort the Accept. --Mike-- ================== The original message was: Hi, I'm working on making my own simple proxy server to learn a bit about socket programming. I'm also implementing the main loop as a seperate thread but since my CSocket.Accept(CSocket) call is in its own loop waiting for a connection, I can't send it a CEvent to shut down.

      Any help would be appreciated.

      1 Reply Last reply
      0
      • B bbrown

        Hi, I'm working on making my own simple proxy server to learn a bit about socket programming. I'm also implementing the main loop as a seperate thread but since my CSocket.Accept(CSocket) call is in its own loop waiting for a connection, I can't send it a CEvent to shut down. Any help would be appreciated.

        R Offline
        R Offline
        Raghav Gupta
        wrote on last edited by
        #3

        Accept in a loop? Thats not a correct way. Create a user interface thread of which the socket is a member and call Accept just once in the Initinstance of the thread ================== The original message was: Hi, I'm working on making my own simple proxy server to learn a bit about socket programming. I'm also implementing the main loop as a seperate thread but since my CSocket.Accept(CSocket) call is in its own loop waiting for a connection, I can't send it a CEvent to shut down.

        Any help would be appreciated.

        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