This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos 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: Any problem ?


On Fri, Mar 25, 2011 at 9:24 PM, Gary Thomas <gary@mlbassoc.com> wrote:
> On 03/25/2011 09:40 AM, ratheesh kannoth wrote:
>>
>> On Fri, Mar 25, 2011 at 9:07 PM, Gary Thomas<gary@mlbassoc.com> ?wrote:
>>>
>>> How are you connecting to the keyboard? ?If you are just using stdin,
>>> the default will be the debug/console channel which is not interrupt
>>> driven and select can't help you.
>
> Top posting is evil, even if you move my quote :-(
>
>>
>> I am new to eCos. Could you please explain a little more.
>
> What file descriptor are you trying to select on and how did you open it?
> Unless it's a device which supports interrupts and asynchronous operations,
> select won't do a lot for you.
>
> Also, you don't say what behaviour you are seeing, just asking if something
> is wrong with this code snippet. ?What does it do? ?How would you expect it
> to behave?
>
>>
>> -Ratheesh
>>>
>>> On 03/25/2011 09:27 AM, ratheesh kannoth wrote:
>>>>
>>>> On Fri, Mar 25, 2011 at 8:54 PM, Gary Thomas<gary@mlbassoc.com>
>>>> ?wrote:
>>>>>
>>>>> On 03/25/2011 09:17 AM, ratheesh kannoth wrote:
>>>>>>
>>>>>> Is there any prob with below code segment ?in eCos ?
>>>>>>
>>>>>> {
>>>>>> ? ? ? ? ? ? ? ?fd_set rd_fds;
>>>>>>
>>>>>> ? ? ? ? ? ? ? ?FD_ZERO(&rd_fds);
>>>>>>
>>>>>> ? ? ? ? ? ? ? ? while (1) {
>>>>>>
>>>>>> ? ? ? ? ? ? ? ? ? ? ? ? ? timeout.tv_sec = 1;
>>>>>> ? ? ? ? ? ? ? ? ? ? ? ? ? timeout.tv_usec = 0;
>>>>>>
>>>>>> ? ? ? ? ? ? ? ? ? ? ? ? ?if (select(0,&rd_fds, NULL, NULL,&timeout)<
>>>>>> ?0) {
>>>>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? printf("\n ?Error \n");
>>>>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? sleep(1);
>>>>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? continue;
>>>>>> ? ? ? ? ? ? ? ? ? ? ? ? ? }
>>>>>>
>>>>>> ? ? ? ? ? ? ? ? ? ? ? ? ?printf("\n ?Success ?\n");
>>>>>> ? ? ? ? ? ? ? ? ?}
>>>>>> ? }
>>>>>>
>>>>>
>>>>> Yes - the first parameter to select() is the number of open file
>>>>> descriptors to check (fd in 0..N-1). ?Putting a zero there will
>>>>> never yield any activity.
>>>>>
>>>>> Typically, one puts the max # of open file descriptors or at
>>>>> least the highest known open one + 1.
>>>
>>>> True. But it runs perfectly on ?eCos and linux. ?I facing some
>>>> problem, whenever i hit a key on keyboard in eCos. Is there connection
>>>> to this select system call here.
>>>
>>> How are you connecting to the keyboard? ?If you are just using stdin,
>>> the default will be the debug/console channel which is not interrupt
>>> driven and select can't help you.
>>>
>>> --
>>> ------------------------------------------------------------
>>> Gary Thomas ? ? ? ? ? ? ? ? | ?Consulting for the
>>> MLB Associates ? ? ? ? ? ? ?| ? ?Embedded world
>>> ------------------------------------------------------------
>>>
>
> --
> ------------------------------------------------------------
> Gary Thomas ? ? ? ? ? ? ? ? | ?Consulting for the
> MLB Associates ? ? ? ? ? ? ?| ? ?Embedded world
> ------------------------------------------------------------
>

Thanks gary. I  am sorry and i wont top post again.


I  did a little more code study. The problem is not at all from the
code snippet. thanks for yout help. But i could not find the root
cause. But i guess some thing fishy. Could you clarify following for
me so that i could further debug. Thanks in advance.

 i used   "printf" could  print character to  STDOUT_FILENO in one
thread  ( thread A). I used "cyg_io_read"  to read some user input in
another thread (thread B).  if i press  ENTER key after entering some
character to console(as user input), my eCos box crashes. Will the
printf output is getting fed to cyg_io_read() ?. I could  be
completely wrong.

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


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