| Subject: | Re: How could pthread_mutex_lock/unlock affect compiler optimization and / or caching?? |
|---|---|
| From: | Paul Pluzhnikov <ppluzhnikov-nsp@xxxxxxxxx> |
| Date: | Fri, 18 Jul 2008 20:29:38 -0700 |
| Newsgroups: | gnu.gcc.help |
mynickmynick <mynickmynick@xxxxxxxxx> writes:
> now I think I got it in my example
...
> as quit is a global variable
> and as pthread_mutex_lock(&mutex); is opaque to the compiler (so it
> might change quit value)
> the compiler thinks it cannot keep quit on a register so loads quit
> form memory at every while iteration
Yes, that's pretty much it.
> while without correction and if
> "{do things without using quit} "
> has no function call
... or only calls functions known to compiler not to modify gobals ...
> the compiler might decide to keep the quit value on a register, so
> deadlocking!
This situation is usually called infinite looping.
For a deadlock, you need to have something blocking on something else.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | false sharing confusion!!, mynickmynick |
|---|---|
| Next by Date: | What have I done wrong?, Pilcrow |
| Previous by Thread: | Re: How could pthread_mutex_lock/unlock affect compiler optimization and / or caching??, mynickmynick |
| Next by Thread: | false sharing confusion!!, mynickmynick |
| Indexes: | [Date] [Thread] [Top] [All Lists] |