| Joe Seigh 2008-01-22, 8:22 am |
| Raxit@MyKavita.com wrote:
> Hi,
>
> normally the execution flow of many threaded programs are like
>
> pthread_mutex_lock
> do some critical region stuff.
> pthread_mutex_unlock
>
> with many if-else-<or switch case or other stuff.+ Loop etc>
>
> No Doubt, Clear Code is Good, but what harm if library<or
> implementation> itself keep Tracks of Lock Acquired by Particular
> thread and when Threads cancel/exit, it will release/unlock all the
> locks acquired by that thread. <so even dummy programmers write buggy
> program, it will not buggy :) > <its like very much conceptually
> similar to Garbage Collection of Heap Memory.>
>
>
Or a collection of garbage which is what you'll end up with if
a program exits with the shared data in an inconsistent state.
Or you can look at it this way. If inconsistency is not a problem,
why use locks? They just slow things down.
--
Joe Seigh
When you get lemons, you make lemonade.
When you get hardware, you make software.
|