Need of Sequential Execution of cBot - Multithreading issue
Need of Sequential Execution of cBot - Multithreading issue
30 Jan 2014, 15:33
Hi
I need my cBot to execute sequentially and one thread at a time - not to be pampered with multiple threads all at once, so making it thread safe by introducing a sync lock does the trick, however pressing stop after the cBot has run 3/4 of the back test makes cAlgo hang. This is possibly because every tick is executed in a different thread which is locked up and needs to wait forming a bottleneck at the lock. cAlgo now possibly waits for all threads to be completed and bang it hangs. Not acceptable and very irritating.
I know I might be wrong in my assumption, but please could you test some cAlgos with locking that is back testing on 1 minute all available history?
Please could you rectify or advise?
Many thanks!! :-)
Spotware
30 Jan 2014, 17:15
The cAlgo API is not multi-threading and you do not need to synchronize anything.
Multi-threading issues could possibly be happening if you are using the Timer class because then that would be invoked in a separate thread. We do not recommend the usage of the Timer class since the cAlgo API is not thread-safe.
The cAlgo API should not be accessed by multiple threads.
@Spotware