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

Support for other Thread structures #9

Open
postmodern opened this issue Apr 5, 2014 · 8 comments
Open

Support for other Thread structures #9

postmodern opened this issue Apr 5, 2014 · 8 comments

Comments

@postmodern
Copy link
Contributor

Would be useful if Queue, SizedQueue were also supported.

@mattn
Copy link
Owner

mattn commented Apr 7, 2014

Mutex is already done. Right?

@postmodern
Copy link
Contributor Author

Ah my mistake, Mutex is indeed there. Queue would definitely be useful for thread pools.

@mattn
Copy link
Owner

mattn commented Apr 7, 2014

As same as reason I commented in another issue, mruby-thread is not green thread. So Queue may not be easy to implement.

@postmodern
Copy link
Contributor Author

@mattn would implementing MRI 1.9 style pthread-based Thread / Mutex require adding a GIL to mruby?

@mattn
Copy link
Owner

mattn commented Apr 7, 2014

mruby-thread is marshaling values between main thread's mrb_state and another thread's mrb_state.

https://github.com/mattn/mruby-thread/blob/master/src/mrb_thread.c#L65

So the proc which is generated in main thread doesn't work at another thread.

@mattn
Copy link
Owner

mattn commented Apr 10, 2014

Is this closable? #7

@postmodern
Copy link
Contributor Author

I think it's possible to implement Queue using pthread_mutex_lock and pthread_mutex_unlock.

@mattn
Copy link
Owner

mattn commented Apr 10, 2014

As I said, mruby-thread is not green thread, So context is not shared. Even though you create Queue out side of thread, you can't manipulate 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