Is there a way to create a semaphore or a mutex to access data from a dynamic list in different threads ?
If you need a global mutex you can use
enter/exit_critical_section. Critical sections will not be interrupted by other threads.
Note though that only
sync/sleep/move commands (commands that use “physical time” as the manual puts it) are points where your thread can yield to other threads. That means that in many cases you don’t really need critical sections and you can simply use global variables to synchronize between threads.
If you don’t want to rely on this behaviour (it’s not documented in the script manual) you can still use global variables to do synchronization between threads, and guard access to these variables with
enter/exit_critical_section. Then you can use a boolean as mutex and an integer as semaphore. Be careful though not to wait for your mutex or semaphore inside a critical section though, since then nobody can every make your wait condition true.