Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming.threads > #2571

Re: Can I get code review for some shared memory RPC code?

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 2014-08-10 15:45 +0000
Organization A noiseless patient Spider
Message-ID <ls843m$945$1@dont-email.me> (permalink)
References <e10e88a1-5526-4257-9053-c98b49fa31ed@googlegroups.com>

Show all headers | 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


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