oliviermilla / InteractiveBrokers.jl

A Julia implementation of Interactive Brokers API
MIT License
2 stars 2 forks source link

are the client request functions thread safe? #3

Open era127 opened 4 weeks ago

era127 commented 4 weeks ago

Hi,

Are the client request functions thread safe, such that tasks across different threads could send separate requests. I see the request are written to the io.

Thanks.

oliviermilla commented 1 week ago

Hello @era127,

It's a good point. I don't think it is from the looks of it: https://github.com/oliviermilla/InteractiveBrokers.jl/blob/d9fa4d66ce27962bbed4be4e9095a448e2a6a51e/src/client.jl#L13

but I'm no super pro when it comes to multi-threading.

Since everything goes through this send_msg, I believe it shouldn't be too hard to reentrant lock it. Any suggestion?