ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Sounds very dangerous to me. If you return true and let somebody go off and mess with some sort of shared memory you could end up with some pretty hard to track bugs. It would be better if you just designed your program so it never had a deadlock and the whole timeout would be a moot point.
creating the app without deadlocks is what im trying to do, by removing the block on the mutex this ensures there will never be a deadlock. win32 and osx have this feature in there mutex and im just trying to apply it to posix aswell so that my abstract base class(for osx, win and nix) works for all.
if this is not a good way of doing it, is there some flag etc that i can change the blocking time with?
Well, all I'm saying is this kind of thing allows your program to disguise a potential major problem. Id rather know that my logic was causing a thread to never release a mutex lock then to think it works and find out later one of the threads wasn't really working properly.
Originally posted by jtshaw Eh.. apparently I'm an idiot I somehow thought you had the default value of the return as true... As for you logic... I do believe that would work.
lol thanks i thought i was missing something, i wouldnt say idiot, coz that would be someone who thought they were wrong but wouldn't admit it
i know its not the most efficient way(well maybe it is coz i dont know another) but i just wanted to give all os's the same funcs. thanks
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.