{"action":"closed","issue":{"url":"https://api.github.com/repos/stephane/libmodbus/issues/246","labels_url":"https://api.github.com/repos/stephane/libmodbus/issues/246/labels{/name}","comments_url":"https://api.github.com/repos/stephane/libmodbus/issues/246/comments","events_url":"https://api.github.com/repos/stephane/libmodbus/issues/246/events","html_url":"https://github.com/stephane/libmodbus/issues/246","id":58407290,"number":246,"title":"Is a libmodbus context really thread-safe?","user":{"login":"mhei","id":1313451,"avatar_url":"https://avatars.githubusercontent.com/u/1313451?v=3","gravatar_id":"","url":"https://api.github.com/users/mhei","html_url":"https://github.com/mhei","followers_url":"https://api.github.com/users/mhei/followers","following_url":"https://api.github.com/users/mhei/following{/other_user}","gists_url":"https://api.github.com/users/mhei/gists{/gist_id}","starred_url":"https://api.github.com/users/mhei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhei/subscriptions","organizations_url":"https://api.github.com/users/mhei/orgs","repos_url":"https://api.github.com/users/mhei/repos","events_url":"https://api.github.com/users/mhei/events{/privacy}","received_events_url":"https://api.github.com/users/mhei/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-20T20:39:05Z","updated_at":"2015-06-09T10:04:50Z","closed_at":"2015-06-09T10:04:50Z","body":"Documentation states:\r\n> A libmodbus 'context' is thread safe and may be shared among as many application\r\n> threads as necessary, without any additional locking required on the part of the caller.\r\n\r\nI wonder whether this is really the case (any longer). In `struct _modbus` there are fields which are `struct timeval` for example, which consists of two sub-fields which are updated in two steps. And both sub-fields are non-atomic types, thought one can assume that updating one field is atomic, can't we?\r\n\r\nI also wonder whether is is really necessary or important, that libmodbus is thread-safe? Modbus itself is a master-slave protocol, so there should be no parallelism. Maybe anybody could illustrate an usage scenario where multiple threads are involved?"}}