add pthread_mutex_protects_3() -- semantic helper This will be our helper for making modifications of code. It hints as to what data items a mutex protects. It does not hing at run time code for production and in-tree. Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
diff --git a/main.c b/main.c index 5f589cc..2fe9a0f 100644 --- a/main.c +++ b/main.c
@@ -119,6 +119,8 @@ printf(" ]\n"); } +#define pthread_mutex_protects_3(mutex, var1, var2, var3) + int main(int argc, char *argv[]) { pthread_t threads[NUM_THREADS]; @@ -142,6 +144,10 @@ show_party(party); pthread_mutex_init(&party->mutex, NULL); + pthread_mutex_protects_3(&party->mutex, + party->food, + party->trash, + party->tid_status); pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);