openframeworks / openframeworks/openFrameworks

ofThreadChannel restart

Open
#6,782 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
10.4k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

Hi,

I wondered if it wouldn't be interesting to have a restart function for a ofThreadChannel?

I need it when restarting an ofThread to receive and send stuff, and I think this is the only way to do it right?
I don't want the ofThreadChannel queue to be bloated by loads of elements before restarting the thread or having to empty it all the time.

I'm using :

class ofThreadChannel{
public:
//[...]
	void reOpen() {
		std::unique_lock<std::mutex> lock(mutex);
		closed = false;
		condition.notify_all();
	}
};

Let me know,

Best,

P

Contributor guide

Open the contributing guide

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.

Research direction

Start with libs/openFrameworks/utils/ofThreadChannel.h and compare the proposed reOpen behavior with the channel's existing close and thread lifecycle semantics. Determine the expected queue and waiting-thread behavior on restart; done should provide a clearly defined restart operation without the queue accumulating stale elements.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.