Buffering of events - to make it threadsafe

Open
#15 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp
Domain
backend

Research direction

The issue centers on the std::queue buffer, HandleEvent, process_event, and the static thread-safe state-access struct. Start by reviewing the project's event-processing and threading guidance; done should be an agreed, validated approach for concurrent event delivery and interactions with the outside world.

Written by the indexing model from the issue text.

Description

I am trying to familiarize myself sc, however I keep ending up with issues.

I have multiple threads that generate events and I am trying to buffer the events in a std::queue and have a thread call process_event with whatever is in the queue.

//typedef
typedef boost::statechart::state_machine<SMVesselServer, SVesselServer>::event_base_type VSEvent; 
--
//queue def
std::queue<std::shared_ptr<VSEvent>> events;
--
//enqueue function
void HandleEvent(std::shared_ptr<VSEvent> e);

Does this approach make sense at all - any references to thread safety would be great.

Besides, getting interactions with the outside world from the states seems non trivial. I have a static struct with thread safe getters and setters at the moment.

Dominant language
C++
Stars
32
Forks
43
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/statechart

All issues in boostorg/statechart

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.