This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: lock


Rosière mathieu wrote:
Hi,

I have a system with multi cpu. All thread running on each cpu, and
write a message on a tty. But the primitive of lock (in <sys/lock.h>) is
not implemented. (in configure.host, i have set the flag
newlib_multithread)

* Have an implementation of this primitive?

You will have to provide your own. There is code for the x86-linux lock in the libc/sys/linux/machine/i386 directory. Are we talking about an existing newlib platform or something new?


* Are they hardware's dependant? (by exemple to use a primitive test and
set)


Yes, it is hardware dependent. If you have an atomic test and set insn or something similar, it is reasonably straightforward. If there is no hardware support you will have to resort to some form of spin-lock.


-- Jeff J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]