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: AW: [PATCH, newlib] Allow locking routine to be retargeted




On 11/11/16 09:37, onkel.jack@t-online.de wrote:
Hello,

to unconditionally provide weak dummy implementation I dont think its a good idea since it has some implications:
If the newlib is compiled for single thread, no locks are required at all, so the dummy implementation/macro is doing the job to
satisfy the linker.
But for multithread its dangerous to provide a dummy since you would not see first hand there are no locks but dummys.

I don't see how is that different from what is happening now. Right now for bare-metal targets the locking macro are always void ones.


So my suggestion would be:
- For single thread leave the implementation as is.
- For multithread, dont provide any lock function, so linking newlib without to provide locking functions from os/kernel
would result in a linkage error, therefore forces the user not to forget to provide them.

So I think, just put something like #ifndef MULTI_THREAD around the existing macros would do it.

That would defeat the purpose IMO. The point is to provide a single newlib build for both single threaded and multithreaded applications: newlib would be built for multithread environment and would work fine for single thread without need to define any function and multithread applications (or more likely the RTOS) can define locking functions to make it work.

Best regards,

Thomas


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