Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement more marker traits? #4

Open
mgeier opened this issue Nov 5, 2020 · 7 comments
Open

Implement more marker traits? #4

mgeier opened this issue Nov 5, 2020 · 7 comments

Comments

@mgeier
Copy link
Owner

mgeier commented Nov 5, 2020

Should the RingBuffer be Send?
I think this might be useful.

It could probably even be Sync, even though this could only be used to get its capacity. But why not?

Could/should the Producer/Consumer be RefUnwindSafe?

What about the other structs?
Are they missing any marker traits?

@mgeier
Copy link
Owner Author

mgeier commented Jul 31, 2021

Since #57, the RingBuffer cannot be owned anymore, so most of this issue has become obsolete.

I'm still unsure if implementing RefUnwindSafe would make any sense.

The other structs seem to implement everything that makes sense.

@RamType0
Copy link
Contributor

RamType0 commented Nov 7, 2021

image
Send for ReadChunk and WriteChunkUninit is needed.

@RamType0
Copy link
Contributor

RamType0 commented Nov 7, 2021

I added it in 401a3ad

@mgeier
Copy link
Owner Author

mgeier commented Nov 15, 2021

Send for ReadChunk and WriteChunkUninit is needed.

I'm not sure if this is sound.

It seems that this would allow to write/read from two different threads each, which isn't allowed for SPSC. But the "chunks" have exclusive access to producer/consumer, so maybe this is OK?

If it is indeed sound, the detailed argument for that should be added as a comment.

@RamType0
Copy link
Contributor

It seems that this would allow to write/read from two different threads each, which isn't allowed for SPSC. But the "chunks" have exclusive access to producer/consumer, so maybe this is OK?

Are you concerning the case having chunk and producer/consumer in different thread by sending only chunk and leave producer/consumer in original thread?

IMHO, the rust lifetime system doesn't allow it because of &mut Producer/Consumer fields in chunks.

Even if you assume that the rust lifetime system allows it, we are already able to have chunk and producer/consumer in different thread without implementing Send for chunks by sending only producer/consumer and leave chunk in original thread.

So, implementing Send for chunks doesn't make "new" problem in both assuming.

@mgeier
Copy link
Owner Author

mgeier commented Dec 21, 2021

I think you are right, and I agree that Send should be implemented.

I added it in 401a3ad

If you want, you can create a separate PR based on the main branch.

RamType0 added a commit to RamType0/rtrb that referenced this issue Jan 17, 2022
@RamType0
Copy link
Contributor

Sorry for late response, I did it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants