Giter Club home page Giter Club logo

Comments (1)

Nickster258 avatar Nickster258 commented on August 17, 2024

I am going to briefly go over my idea and plan for the participant code.

I am thinking of having 3 main tasks as part of a task pool managed by participant.cpp. This participant.cpp is ran by a participant_main.cpp, whose job it is to just run that single instance of Participant. The three tasks that the participant makes, and manages, are as follows:

  1. ConsoleTask. This task's job is to take whatever input, depending upon the indication presented by the interface using it, and display it. The idea is that it will erase a line, replacing it with a message (in the case of a multicast receive), or print a new prompt. In just typing this out, I am realizing there is probably a better way, but I am floating this out there for now.
  2. MessengerTask. This task's job is to manage the socket on its own thread and send received messages to the ConsoleTask for it to format accordingly. Since this task handles the socket connection, it will also send messages that can be received in an internal outgoing message queue.
  3. InputTask. This task's job is to listen to the user's input and interject the necessary results into ConsoleTask and/or MessageTask. This "task" doesn't have to be a task. It could be done in the main thread.

A few quick notes on my own ideas though. First, all of the necessary processes could probably be handled in just 2 threads without being that complicated. Second, I am not sure if implementing the participant this way is abusing the thread_pool system, rather than utilizing it.

In any event, those are my thoughts as of yet. I have already developed a method to "replace" a prompt in console and re-print the prompt to accept user input.

from csci6780.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.