{"action":"created","issue":{"url":"https://api.github.com/repos/kyle-github/libplctag/issues/18","labels_url":"https://api.github.com/repos/kyle-github/libplctag/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/kyle-github/libplctag/issues/18/comments","events_url":"https://api.github.com/repos/kyle-github/libplctag/issues/18/events","html_url":"https://github.com/kyle-github/libplctag/issues/18","id":112632743,"number":18,"title":"Rewrite core to use tasklet idea","user":{"login":"kyle-github","id":1820043,"avatar_url":"https://avatars.githubusercontent.com/u/1820043?v=3","gravatar_id":"","url":"https://api.github.com/users/kyle-github","html_url":"https://github.com/kyle-github","followers_url":"https://api.github.com/users/kyle-github/followers","following_url":"https://api.github.com/users/kyle-github/following{/other_user}","gists_url":"https://api.github.com/users/kyle-github/gists{/gist_id}","starred_url":"https://api.github.com/users/kyle-github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyle-github/subscriptions","organizations_url":"https://api.github.com/users/kyle-github/orgs","repos_url":"https://api.github.com/users/kyle-github/repos","events_url":"https://api.github.com/users/kyle-github/events{/privacy}","received_events_url":"https://api.github.com/users/kyle-github/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-21T16:49:25Z","updated_at":"2015-12-08T16:44:27Z","closed_at":null,"body":"Rewrite the core of the software to use something like Java's Runnable/tasklets.  Pull most of the work over into the back-end rather than the current 50/50 split between the front end and the back.\r\n\r\nThe front end would have a single, simpler, plctag struct that would contain:\r\n\r\n* a reference to the attribs (currently discarded after tag creation).\r\n* a reference to the location of the data array.\r\n* a set of flags for read requests, write requests, abort requests and delete requests.  Do these need to be single ints (or whatever size atomic wants) or should they be protected by an atomic flag and be bit flags.   Leaning toward single ints as those could be handled with a CAS.\r\n* size information about the data array (do we care about element size or just total bytes?).\r\n* status information (one int as now or a set of flags?).\r\n\r\nWhen a client called the library API functions on a tag, they will set one of the flags to ask the back-end to perform the requested operation.  This will be the only interaction between the front and back end.  \r\n\r\nStatus will be read only on the front end.  The back end will only set it.\r\n\r\nDelete requests will cause the back-end to asynchronously remove the resources used by the tag.  This includes the memory the for the public side of the tag as well.\r\n\r\nThe back end will have one entry point called from the front end: tag creation.  The sequence of events will look something like this:\r\n\r\n* client code calls plc_tag_create.\r\n* plc_tag_create allocates memory for the tag and sets up what it can.\r\n* plc_tag_create determines which back-end protocol creation function to call and calls it with the completed tag.\r\n* xyz_tag_create creates any auxiliary structures needed and a tasklet for the tag.  The tasklet will reference (or will be) the aux data and reference the plc_tag struct.  This will require mutex or spin-lock protection.  Mutexes are cheap on Linux but expensive on most other platforms.  Maybe use spin-locks as fine-grained protection.\r\n* the tasklet will go through its initial state machine to determine whether there is an existing socket it can reuse and any other intermediate objects it needs to create.  \r\n* each socket will have a tasklet as well.  This will need to be protocol specific.\r\n* intermediate tasklets (such as for connected AB CIP tags) may exist as well.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/kyle-github/libplctag/issues/comments/162941010","html_url":"https://github.com/kyle-github/libplctag/issues/18#issuecomment-162941010","issue_url":"https://api.github.com/repos/kyle-github/libplctag/issues/18","id":162941010,"user":{"login":"kyle-github","id":1820043,"avatar_url":"https://avatars.githubusercontent.com/u/1820043?v=3","gravatar_id":"","url":"https://api.github.com/users/kyle-github","html_url":"https://github.com/kyle-github","followers_url":"https://api.github.com/users/kyle-github/followers","following_url":"https://api.github.com/users/kyle-github/following{/other_user}","gists_url":"https://api.github.com/users/kyle-github/gists{/gist_id}","starred_url":"https://api.github.com/users/kyle-github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyle-github/subscriptions","organizations_url":"https://api.github.com/users/kyle-github/orgs","repos_url":"https://api.github.com/users/kyle-github/repos","events_url":"https://api.github.com/users/kyle-github/events{/privacy}","received_events_url":"https://api.github.com/users/kyle-github/received_events","type":"User","site_admin":false},"created_at":"2015-12-08T16:44:27Z","updated_at":"2015-12-08T16:44:27Z","body":"Fixes in progress."}}