User Profile
Collapse
-
Looking for a macro equivalent to strlen()
Is there any way of getting the length of a const char[] at compile time using macros? -
Very interesting comment.
Some remarks or observations from my experience:
I agree that a preemptive system is less responsive to your custom ISRs, since they need to compete with the ones under control of the scheduler. Though, I also must say that the ISR's I write for one or other system do not change much: they are as short as possible, and leave the processing to background tasks, regardless if they... -
I think it's a basic one.
If you do the same program, non-preemptive fashioned for an 8-bit OSless environment it won't change much from target to target, or even not change at all from a point of view of design.
If you move the same application to a preemptive/multitasking scheme, it will be totally different.Leave a comment:
-
Not building an OS. Just wondering the parameters to be taken into account when choosing one scheme or the other.Leave a comment:
-
Preemptive vs non-preemtive schemes
I see two main big groups in embedded development:
-Preemptive scheme, with several processes and/or threads running on the same system
-Non-preemptive scheme, with interrupts
I've read in some documentation that "preemptive scheme, in general, is more efficient". But such systems imply running constantly a scheduler. From Michael Barr's website I've learnt about the so-called "schedulabl e-bound",... -
Communication by means of a variable between threads
In a UNIX-like environment, I'm wondering following:
Given a certain variable, whose values is modified from a thread and read from another thread, should it be mutex-protected? Or perhaps the question depends on the concrete implementation on the OS / platform?
I mean, the variable is always modified from the same thread, and read from the same (different) thread. -
Well, you weren't that paranoid. I found out documentation on my OS literally states: "A given socket can be read or written by only one task at a time".
So my will of having separate threads reading and writting is not possible. I'll have to think of something else.
The reason for my question was to take as much advantadge as possible of the OS services: If something is already solved by the OS there is no...Leave a comment:
-
Knowing if a file descriptor is open
Is there any way, using fcntl() to know whether a filedescriptor is open or closed (*NIX environment) -
I'm using read(), write() and close(), which are syscalls. I don't know if in the background they're using socket library functions in my case. Are they?
I'm just defending my point as I see it. My concern is producing quality code, and for discussing something and getting at the top of an issue I have to follow some reasoning line. I can't tell my management "I'm not doing it like this because some guru suggested...Leave a comment:
-
I'm aware of the problems of not mutexing things and so on and so forth, but what I'm worried here is about the specific issue:
"Is it possible to work on the same file descriptor (for a socket, if that's relevant) from several threads at the same time?"
If not, why not? How can I overcome this?
My problem is that I have to implement bidirectional communication, without no end being a master....Leave a comment:
-
Aw... that was painful to read.
Seriously, there is no way I can use it from a separate thread? Currently I'm passing the fd number as argument of a new thread. It works. But don't know if me and my app will end up in developer's hell for that.
What about dup()? Would it help here?...Leave a comment:
-
*NIX sockets question
I've started with socket programming and follow question arose:
If, in the server, I get a client/socket connection with function:
Code:client_sockfd = accept( server_sockfd, (struct sockaddr *) &client_address, &client_len );
I'm thinking of creating a thread to... -
-
read() and write() behavior in *NIX
When the file descriptor on which read() and write() apply is set up in such a way so that these syscalls block (for instance, until no data is available to read() from a serial port), I wonder following:
What's the processor doing with this process while waiting, in general, in a *NIX? Is it busy-waiting, or sleeping? -
By the way,
Thanks for your comment:
It was a critical issue I wouldn't have been aware myself. Now I'll use localtime_r() which my system implements....Leave a comment:
-
Thanks again Banfa.
I've changed now my main reference for C language from "http://www.acm.uiuc.ed u/webmonkeys/book/c_guide/" to "http://www.cplusplus.c om/reference/", as I see it is more completeLeave a comment:
-
gmtime and localtime functions from time.h
Following prototypes apply for localtime and gmtime:
Code:struct tm *localtime(const time_t *timer); struct tm *gmtime(const time_t *timer);
If they do not allocate it, where does its memory come from? -
Thanks for the explanations.
Anyway, going to simple things.
Code:int t=0x1234; char* p = (char*)&t; char x = *p;
According to weaknessforcats , big-endian is "the lowest address has got the MSB" (The big-end in byte 1), and little-endian is "the lowest address has got the LSB" (The little-end in byte 1).
Let's say our universe is...Leave a comment:
-
Ok.
So it happens to be the opposite of what I had in mind.
Anyway, going further:
In general, if I declare:
Code:char c[1];
Thanks,Leave a comment:
-
Endianism
I'm aware of the importance of the concept of endianism, but I don't really know its formal definition.
In particular, what does mean "big-endian" when applied to network programming?
i.e., which byte "comes first" from the bus, in a big-endian tx scheme?
Regarding compilers, for a type of 16 bits, will it make any difference the operation:
(0xff & ( t_16_data >>...
No activity results to display
Show More
Leave a comment: