Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How much should be done on the main thread?

Comments in 'Plugin Development' started by PEMapModder, Mar 28, 2015.

  1. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I have a thread that listens to the http requests. I read the requests in my thread, then push the requests into a thread-safe buffer. The main thread every tick reads requests from the buffer, handle them in the main thread and generate a response that is pushed into another buffer, where the new buffer is cleaned by the server thread every tick of the server thread. The server thread shall write the generated response to the saved sockets and close the socket. Is this thread-safe and good?

Share This Page

Advertisement