Open postmodern opened 10 years ago
Mutex is already done. Right?
Ah my mistake, Mutex is indeed there. Queue would definitely be useful for thread pools.
As same as reason I commented in another issue, mruby-thread is not green thread. So Queue may not be easy to implement.
@mattn would implementing MRI 1.9 style pthread-based Thread / Mutex require adding a GIL to mruby?
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.
Is this closable? #7
I think it's possible to implement Queue using pthread_mutex_lock
and pthread_mutex_unlock
.
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,
Would be useful if Queue, SizedQueue were also supported.