Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming.threads > #2571
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | andrew@cucumber.demon.co.uk (Andrew Gabriel) |
| Newsgroups | comp.programming.threads |
| Subject | Re: Can I get code review for some shared memory RPC code? |
| Date | Sun, 10 Aug 2014 15:45:58 +0000 (UTC) |
| Organization | A noiseless patient Spider |
| Lines | 26 |
| Sender | andrew@a20 |
| Message-ID | <ls843m$945$1@dont-email.me> (permalink) |
| References | <e10e88a1-5526-4257-9053-c98b49fa31ed@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Injection-Date | Sun, 10 Aug 2014 15:45:58 +0000 (UTC) |
| Injection-Info | mx05.eternal-september.org; posting-host="564b18614511828cf2a82c5cd4db0afd"; logging-data="9349"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+rdB/YEudnw0VMOCGaxtmCTbRRLaNXbpI=" |
| X-Newsreader | knews 1.0c.0 |
| Cancel-Lock | sha1:0XqcrZ1PEjQUACkeUxAn4x9PSgw= |
| Xref | csiph.com comp.programming.threads:2571 |
Show key headers only | View raw
In article <e10e88a1-5526-4257-9053-c98b49fa31ed@googlegroups.com>, Steven Stewart-Gallus <stevenselectronicmail@gmail.com> writes: > The code should be fairly portable (at least with futex use disabled). > Of course, I'm using POSIX threads as C11 threads aren't widely > implemented. I have absolutely zero experience doing any sort of > complicated multithreaded programming with atomics (I prefer to stick > to isolated heaps and very simple message queues) so the code is > probably broken in some way. One thing that doesn't help is that I > can only test on x86 right now (which has a very strong memory model). > Annoyingly, there's no portable pause intrinsic but it should be > really easy to s/_mm_pause/my_pause/g for a different architecture. Your wait_until_different and hint_wakeup should be replaced by a condition variable (cond_wait, and cond_signal or cond_broadcast). Then the need for your pause function and spin loop go away. I don't know how portable the atomic_* functions are that you are using. I would use a mutex protected variable, which should work everywhere, if portability is important. I did not look at the program logic in detail, as you didn't describe what you intended it to do. -- Andrew Gabriel [email address is not usable -- followup in the newsgroup]
Back to comp.programming.threads | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Can I get code review for some shared memory RPC code? Steven Stewart-Gallus <stevenselectronicmail@gmail.com> - 2014-08-08 19:17 -0700
Re: Can I get code review for some shared memory RPC code? andrew@cucumber.demon.co.uk (Andrew Gabriel) - 2014-08-10 15:45 +0000
Re: Can I get code review for some shared memory RPC code? Steven Stewart-Gallus <stevenselectronicmail@gmail.com> - 2014-08-10 20:57 -0700
csiph-web