I have a program which needs to utilize 2 "real" threads. Thread-A contains a blocking function call to the kernel. Whenever the function returns from the kernel, thread-A updates a variable which Thread-A shares with Thread-B. Thread-B carries its own task/job using the current value of this variable. This uncoordinated program flow is supposed to continue indefinitely.
How can I implement such a program in Julia? The tasks/coroutine construct in julia is not capable of performing such an operation. When task-A is blocked by the kernel call (which is a C-function call with a ccall), the entire program is blocked. Apparently, Tasks is effective in julia only if all blocking calls are made with Julia's own I/O functions. Otherwise, the julia's internal scheduler completely fails to switch between threads. (Am I right?) Furthermore, I cannot use parallel processing utilities in julia either as the thread A and B need to operate on the same variable. Parallel processing construct such as spawn depends on kernel-processes which is not capable of sharing a variable. Remote call/fetch requires one process to finish to return a value. (Again, am I right?) So, as a result, how can I implement such a simple computational structure in Julia? Any pointer for a reasonable algorithm is greatly appreciated.