JuliaLang/julia — pull request #5817 by amitmurthy (2014-02-14 09:55:44+00:00)
Title: RFC/WIP : Extensible remote synchronization objects

This PR replaces https://github.com/JuliaLang/julia/pull/5791 and make it possible to extend the types of process synchronization facilities that can be provided.

Consequently, `channels(), tspaces() and kvspaces()` as implemented previously in https://github.com/JuliaLang/julia/pull/5791 are now available as an external package - https://github.com/amitmurthy/SyncObjects.jl .

The user needs to provide a concrete implementation of `AbstractRemoteSyncObj` with `so` an object of type `SyncObjData`, and the following callbacks : `test_cantake`, `test_canput`, `fetch`, `put` and `take`

For example type `RemoteChannel` used to provide a `channel` functionality is defined in https://github.com/amitmurthy/SyncObjects.jl as

```
type RemoteChannel <: AbstractRemoteSyncObj
q::Vector
sz

so::SyncObjData
test_cantake::Function
test_canput::Function
fetch::Function
put::Function
take::Function

RemoteChannel(T, sz) = new(Array(T, 0), sz, SyncObjData(), rccantake, rccanput, rcfetch, rcput, rctake)
end
```

The actual remote object is created using a new method `syncobj_create(pid, T::Type, args...)` where T is the type of synchronization object being created.

As previously stated this is an alternative approach to having native `Channels` support in Julia (as in https://github.com/JuliaLang/julia/pull/5757).