- C++ condition variable confusion - 8 Updates
- initialization and copying of class array member - 3 Updates
- C++ move constructors - 2 Updates
Sam <sam@email-scan.com>: Mar 17 09:33AM -0400 Paavo Helde writes: >> variables in the first place. > You could, but your program would consume 100% CPU with spinning, versus 0% > with wait. That brain surgeon does not understand how wait() works, and why it's needed? I think we're looking at a future Microsoft Windows developer, here. |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Mar 17 02:53PM +0100 On 16.03.2019 04:23, Chris M. Thomasson wrote: > Imvvho, read the following book several times: > https://www.amazon.com/Programming-POSIX-Threads-David-Butenhof/dp/0201633922 > Then, read it again... ;^) I coded up in C++ the second program from the book, page 15 in the 1997 edition, but it was apparently not possible to express it portably. I found that I could express it so that it works in Windows in Unix, by adding system-specific includes. Apparently `waitpid` behaves differently in Windows WSL than in the Unix the author used, or do I understand it incorrectly? ------------------------------------------------------------------------- // A C++ version of "alarm_fork.c" on page 15 of "Programming with Posix threads" 1997. #ifdef _WIN32 # define IS_WINDOWS 1 # define IS_UNIX 0 #elif defined( __unix__ ) or (defined( __APPLE__ ) and defined( __MACH__ )) # define IS_WINDOWS 0 # define IS_UNIX 1 #else # error "Unsupported operating system."
Subscribe to:
Post Comments (Atom)
|
No comments:
Post a Comment