I'm using pthread_mutex_t
locks to "lock around" a complex typed variable a (std::list
). I say "lock around" because pthread_mutex_lock()
doesn't use the actual the std::list
variable as C#'s lock
does. So the std::list
object has no idea it is being locked for access.
So I really don't know the answer to 2 questions:
1) Does marking a complex type as volatile
(other than int
, float
etc) have any effect in C++? I am not sure since the above linked article lists (which for C#) only the primitive types and reference types as capable of being marked volatile
.
2) Do I need to mark C++ complex types as volatile
as long as I am manually locking them?