Code: Select all
typedef interface a_conn_if_t {
void do_io_server (const unsigned value_to);
[[notification]] slave void all_clients_seen (void);
[[clears_notification]] {unsigned} get_result (void);
} a_conn_if_t;
I am struggling with a system where there are (like) 8 clients and 8 servers and I try to make a system where they would all be synchronised. It's all described in a blog note [2], but at the moment this point is not clear at all.
Each client is connected to three servers (and each server to three clients) - none of the clients with each other, none of the servers with each other. It's a torus topology, with always three neighbours. The theme in the blog note is something else, but my main question here is about some conclusion I am testing:
The [[notification]] and [[clears_notification]] scheme is only thought to be used in an asynchronous scheme to protect a server from being used by more than one client at a time. It will not work for multiple clients inside a server.
If I am wrong on this then I need to debug further.
I have tried to use it for three clients, when all are "inside", all having called do_io_server then they all get a notification all_clients_seen each and all respond with get_result which clears the notification.
My code stops after some time, and I can see in the debugger that it stops on the same place. Running the same with a clean do_io_server interface works, but then they are really not "fair". One or two clients may be hot spots. That's what I tried to fix, either with a [[guarded]] (but the compiler crashes (reported to XMOS)) or with the above scheme.
The reason I thought that the scheme wasn't thought to cover my case is because if I drop [[clears_notification]] then the code runs further. Also that in [1] it says that
which means that there is some low level state or lock that the compiler keeps track of below the hood. For one-client-in-at-a-time logic?Once the server raises a notification, it triggers an event at the client end of the interface. However, repeatedly raising the notification has no effect until the client clears the notification. This can be done by marking one or more functions in the interface with the [[clears_notification]] attribute. The client will then clear the notification whenever it calls that function. (page 24)
I see that my functionality really is that of a barrier, which I have built, but at that time I was forced to use channels. I think I now know why. That code is at [3] 209.alive.
[1] XMOS Programming Guide (as of 17Jan2018: 2015/9/21 version F, 2015/9/18 in the document), see https://www.xmos.com/published/xmos-programming-guide
[2] My XC combined combinable notes (Disclaimer, no money, ads, gifts, only fun and expenses)
[3] My XC code downloads page