mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Document the concurrency boundaries of worker threads
This commit is contained in:
parent
2bf0fcf97c
commit
d49a45c43f
1 changed files with 16 additions and 1 deletions
17
cmdline/io.h
17
cmdline/io.h
|
|
@ -76,7 +76,13 @@ struct snapraid_worker {
|
|||
thread_id_t thread; /**< Thread context for the worker. */
|
||||
#endif
|
||||
|
||||
struct snapraid_io* io; /**< Parent pointer. */
|
||||
/**
|
||||
* Parent pointer.
|
||||
*
|
||||
* Note that worker threads must NOT use this pointer to access
|
||||
* the global state (io->state).
|
||||
*/
|
||||
struct snapraid_io* io;
|
||||
|
||||
void (*func)(struct snapraid_worker*, struct snapraid_task*);
|
||||
|
||||
|
|
@ -182,6 +188,15 @@ struct snapraid_worker {
|
|||
* io_stop(&io);
|
||||
*/
|
||||
struct snapraid_io {
|
||||
/**
|
||||
* Pointer to the global state.
|
||||
*
|
||||
* Note that this pointer must NOT be accessed inside worker threads
|
||||
* (e.g. data_reader/writer, parity_reader/writer functions).
|
||||
* Workers must only operate on their pre-allocated buffers and local task variables,
|
||||
* while any state modifications must strictly happen on the main thread
|
||||
* after I/O completion.
|
||||
*/
|
||||
struct snapraid_state* state;
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue