Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

shctx.c could use less assembler #35

Open
sesse opened this issue Oct 1, 2011 · 2 comments
Open

shctx.c could use less assembler #35

sesse opened this issue Oct 1, 2011 · 2 comments

Comments

@sesse
Copy link

sesse commented Oct 1, 2011

It seems like shctx.c is written with several inline assembler parts to get atomic operations. GCC has a relatively rich set1 of these; possibly not everything that the file needs, but at least the cmpxchg() function could probably be replaced by __sync_val_compare_and_swap().

@EmericBr
Copy link

__sync_val_compare_and_swap gcc builtin appear in gcc v4.1.* . My embedded solution product, as a lot of embedded solutions, use a gcc v3 based toolchain.

If the assembled code is a problem, pthread_mutex usage is more portable.

@EmericBr
Copy link

#109 use atomic ops sync built-ins in fallback if current arch does not support x86 asm (built-ins atomics op implementation is less optimized).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants