timer_create problem

by pavan savoy » Wed, 03 Dec 2008 20:04:44 GMT


Sponsored Links
 Hi,

I am trying to port a code which has a timer_create

I get an EINVAL error, which suggests that there isn't a defined clock ID,
However I do see a definition for CLOCK_REALTIME,
What's happening, the second argument, that of sigevent seems ok in my case,
and the 3rd argument is returned..

So is this a problem with the 1st argument, If so, why is it occuring ? even
thou' CLOCK_REALTIME is defined ??

regards,
Pavan

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [EMAIL PROTECTED]
website: 



timer_create problem

by David Turner » Wed, 03 Dec 2008 22:05:23 GMT


 Can you give more details on how you setup your timer. For the record,
SIGEV_THREAD timers are not supported on the G1.
This will be fixed soon in an upcoming update to the system code though.

On the other hand, it should be relatively easy to work-around the issue by
creating a thread that does the wait and function callback (which is
essentially what the implementation is going to do anyway).

If this is not a SIGEV_THREAD timer, please provide a small test case to
reproduce the issue, and I'll look into it





--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [EMAIL PROTECTED]
website: 


Sponsored Links


timer_create problem

by pavan savoy » Wed, 03 Dec 2008 22:09:20 GMT


 Hi,

About to mail that,

So I suppose the problem is not with the CLOCK_REALTIME, but with
SIGEV_THREAD, I have a SIGEV_THREAD unfortunately, now trying out with
SIGEV_SIGNAL, just to make sure, that's the problem...

Here is how I setup...

    evp.sigev_value.sival_int = *timerHandle; // pass the handle as argument
    evp.sigev_notify_function = TimerHandlerFunc;
    evp.sigev_notify_attributes = NULL;
    evp.sigev_notify = SIGEV_THREAD;

    rc = timer_create(CLOCK_REALTIME, &evp, &timerParams[idx].timerId);








--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [EMAIL PROTECTED]
website: 



timer_create problem

by pavan savoy » Wed, 03 Dec 2008 23:55:54 GMT


 Well, Only SIGEV_NONE seems to be working .....

Can I expect a fix anytime soon ? Or else should I start working on a
work-around ??

regards,
Pavan







--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [EMAIL PROTECTED]
website: 



timer_create problem

by David Turner » Thu, 04 Dec 2008 01:16:02 GMT


 hmmm, SIGEV_SIGNAL should be working. Do you have a test case that shows it
doesn't ? (stupid question, is the signal properly unblocked ?)

Apart from that, I really can't give you any ETA, so if it's urgent to you,
I recommend to use the "create-your-own-waiting-thread" approach instead.








--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [EMAIL PROTECTED]
website: 



timer_create problem

by pavan savoy » Thu, 04 Dec 2008 15:31:45 GMT


 i,

Its some-one else's code & its huge, anyways,
the functionality doesn't seem to break if I use SIGEV_NONE.
Should I expect it to break ? Since the code doesn't really depend on
SIGEV_THREAD specifically [I may be wrong..]

Anyway, I'll get back as to why the SIGEV_SIGNAL isn't working, all I know
is, I get a timer_create error itself.
i.e EINVAL - Invalid argument.

So I am not sure how to actually test its working :(

regards,
Pavan

On Wed, Dec 3, 2008 at 7:15 PM, David Turner <[EMAIL PROTECTED]> wrote:


--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [EMAIL PROTECTED]
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---



timer_create problem

by David Turner » Thu, 04 Dec 2008 21:56:37 GMT


 he functionality might not break if the callback is used to handled
exceptional signals, i.e. that doesn't necessarily mean that using a
SIGEV_NONE won't introduce a hideous bug.
Do you know exactly what the signal callback function does ?

can you provide a small code extract that shows how you setup your call for
SIGEV_SIGNAL timer creation ?

thanks in advance

On Thu, Dec 4, 2008 at 7:31 AM, pavan savoy <[EMAIL PROTECTED]> wrote:


--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [EMAIL PROTECTED]
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---



timer_create problem

by pavan savoy » Fri, 05 Dec 2008 18:39:30 GMT


 i,

Where should I be looking, if I want to see support for SIGEV_THREAD.

I am still trying to setup the SIGEV_SIGNAL, it seems it does work, the
mistake was mine, but even then aren't they system calls, and shouldn't I be
looking in the kernel for implementation ??


regards,
Pavan

On Thu, Dec 4, 2008 at 1:56 PM, David Turner <[EMAIL PROTECTED]> wrote:


--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [EMAIL PROTECTED]
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---



timer_create problem

by David Turner » Fri, 05 Dec 2008 21:46:51 GMT


 t will appear on the open-source git server soon, but I can't give an ETA
for this.

otherwise, this involves modifying the C library. SIGEV_THREAD timers are
not supported by the Linux kernels.
Instead, the C library must implement them. In the case of Bionic, this is
done with one plain pthread per timer,
which essentially calls pthread_cond_wait() in a loop.

On Fri, Dec 5, 2008 at 9:39 AM, pavan savoy <[EMAIL PROTECTED]> wrote:


--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [EMAIL PROTECTED]
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---



timer_create problem

by pavan savoy » Fri, 05 Dec 2008 22:03:46 GMT


 ey thanks for the quick response..
However got the statically linked app working, So I won't be waiting on it.

Thanks,
Pavan

On Fri, Dec 5, 2008 at 1:46 PM, David Turner <[EMAIL PROTECTED]> wrote:


--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [EMAIL PROTECTED]
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---



timer_create problem

by henry.lon...@gmail.com » Mon, 16 Feb 2009 03:14:02 GMT


 hi,

i played with timer_create routine with the following code. it seems
the timer is working, but the cpu utilization is really high(over 90%)
if i run "top". Any idea what's going on on G1?

Thanks!

-----------------------------------------------------------------------------------------------------
        se.sigev_notify = SIGEV_THREAD;
        se.sigev_notify_function = timer_handler;
        se.sigev_signo = SIGUSR1;
        timer_create(CLOCK_REALTIME, &se, &tid);

        memset(&ts, 0, sizeof(struct itimerspec));
        ts.it_value.tv_sec = 0;
        ts.it_value.tv_nsec = 30000000;
        ts.it_interval.tv_sec = 0;
        ts.it_interval.tv_nsec = 30000000;
        result = timer_settime(tid, 0, &ts, 0);

--~--~---------~--~----~------------~-------~--~----~

-~----------~----~----~----~------~----~------~--~---



timer_create problem

by David Turner » Mon, 16 Feb 2009 09:31:58 GMT


 this one's for me :-)

Can you send me a small compilable test program to reproduce this (it'd be
much better for me since
I don't know what your timer_handler function is doing there).

It might be a bug in the SIGEV_THREAD timer implementation, I checked and
tested it for correctness but didn't look at CPU usage, I admit.

By the way, sigev_signo isn't used with SIGEV_THREAD timers.

On Mon, Feb 16, 2009 at 4:13 AM, henry.lon...@gmail.com <




--~--~---------~--~----~------------~-------~--~----~

-~----------~----~----~----~------~----~------~--~---



timer_create problem

by David Turner » Mon, 16 Feb 2009 09:50:02 GMT


 ok, I found the bug in the timer implementation, a fix is coming soon.






--~--~---------~--~----~------------~-------~--~----~

-~----------~----~----~----~------~----~------~--~---



timer_create problem

by henry.lon...@gmail.com » Mon, 16 Feb 2009 19:48:37 GMT


 That's great. I found similar problem for SIGEV_SIGNAL. Could you
please let me know when the fix is released?

Thanks!





--~--~---------~--~----~------------~-------~--~----~

-~----------~----~----~----~------~----~------~--~---



timer_create problem

by henry.lon...@gmail.com » Mon, 16 Feb 2009 19:57:10 GMT


 That will be great if you could also mention the source code location
of the fix so that i could make sure i have the fix once you publish
it.

Thanks again!





--~--~---------~--~----~------------~-------~--~----~

-~----------~----~----~----~------~----~------~--~---



Other Threads

1. FATAL EXCEPTION

**
*Hi, All*
**
I have some FATAL EXCEPTION which i could not figure it out. Can any one
help me. here is the log cat. will be very thankful to you.




04-12 12:05:17.069: DEBUG/AndroidRuntime(296): >>>>>>>>>>>>>> AndroidRuntime
START <<<<<<<<<<<<<<
04-12 12:05:17.079: DEBUG/AndroidRuntime(296): CheckJNI is ON
04-12 12:05:17.459: DEBUG/AndroidRuntime(296): --- registering native
functions ---
04-12 12:05:18.559: DEBUG/AndroidRuntime(296): Shutting down VM
04-12 12:05:18.569: DEBUG/dalvikvm(296): De{*filter*} has detached; object
registry had 1 entries
04-12 12:05:18.599: INFO/AndroidRuntime(296): NOTE: attach of thread 'Binder
Thread #3' failed
04-12 12:05:19.269: DEBUG/AndroidRuntime(306): >>>>>>>>>>>>>> AndroidRuntime
START <<<<<<<<<<<<<<
04-12 12:05:19.269: DEBUG/AndroidRuntime(306): CheckJNI is ON
04-12 12:05:19.519: DEBUG/AndroidRuntime(306): --- registering native
functions ---
04-12 12:05:20.579: INFO/ActivityManager(58): Starting activity: Intent {
act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
flg=0x10000000 cmp=com.SpinnerDemo/org.me.sfBackendClient.SpinnerDemo }
04-12 12:05:20.659: DEBUG/AndroidRuntime(306): Shutting down VM
04-12 12:05:20.669: DEBUG/dalvikvm(306): De{*filter*} has detached; object
registry had 1 entries
04-12 12:05:20.709: INFO/AndroidRuntime(306): NOTE: attach of thread 'Binder
Thread #3' failed
04-12 12:05:20.749: INFO/ActivityManager(58): Start proc com.SpinnerDemo for
activity com.SpinnerDemo/org.me.sfBackendClient.SpinnerDemo: pid=312
uid=10048 gids={3003, 1015}
04-12 12:05:21.639: DEBUG/AndroidRuntime(312): Shutting down VM
04-12 12:05:21.639: WARN/dalvikvm(312): threadid=1: thread exiting with
uncaught exception (group=0x4001d800)
04-12 12:05:21.669: ERROR/AndroidRuntime(312): FATAL EXCEPTION: main
04-12 12:05:21.669: ERROR/AndroidRuntime(312): java.lang.RuntimeException:
Unable to instantiate activity
ComponentInfo{com.SpinnerDemo/org.me.sfBackendClient.SpinnerDemo}:
java.lang.ClassNotFoundException: org.me.sfBackendClient.SpinnerDemo in
loader dalvik.system.PathClassLoader[/data/app/com.SpinnerDemo-2.apk]
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
android.os.Handler.dispatchMessage(Handler.java:99)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
android.os.Looper.loop(Looper.java:123)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
android.app.ActivityThread.main(ActivityThread.java:4627)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
java.lang.reflect.Method.invokeNative(Native Method)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
java.lang.reflect.Method.invoke(Method.java:521)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
dalvik.system.NativeStart.main(Native Method)
04-12 12:05:21.669: ERROR/AndroidRuntime(312): Caused by:
java.lang.ClassNotFoundException: org.me.sfBackendClient.SpinnerDemo in
loader dalvik.system.PathClassLoader[/data/app/com.SpinnerDemo-2.apk]
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
java.lang.ClassLoader.loadClass(ClassLoader.java:573)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
java.lang.ClassLoader.loadClass(ClassLoader.java:532)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
android.app.Instrumentation.newActivity(Instrumentation.java:1021)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     ... 11 more
04-12 12:05:21.689: WARN/ActivityManager(58):   Force finishing activity
com.SpinnerDemo/org.me.sfBackendClient.SpinnerDemo
04-12 12:05:22.212: WARN/ActivityManager(58): Activity pause timeout for
HistoryRecord{440603a8 com.SpinnerDemo/org.me.sfBackendClient.SpinnerDemo}
04-12 12:05:32.754: WARN/ActivityManager(58): Activity destroy timeout for
HistoryRecord{440603a8 com.SpinnerDemo/org.me.sfBackendClient.SpinnerDemo}
04-12 12:06:57.368: DEBUG/SntpClient(58): request time failed:
java.net.SocketException: Address family not supported by protocol
04-12 12:07:00.248: DEBUG/dalvikvm(58): GC_FOR_MALLOC freed 10659 objects /
550192 bytes in 162ms
04-12 12:10:21.770: INFO/Process(312): Sending signal. PID: 312 SIG: 9
04-12 12:10:21.818: INFO/ActivityManager(58): Process com.SpinnerDemo (pid
312) has died.
04-12 12:11:57.369: DEBUG/SntpClient(58): request time failed:
java.net.SocketException: Address family not supported by protocol

-- 

2. Getting a delay between starting current activity after returning from startActivityForResult()

Hello guyz,

I am facing problem with starting MainActivity again and perform
remaining tasks, after returning from startActvityForREsult()

My code structrue goes like:

MainActivity{
  // this method calls different activities of my application based on
the result of onActivityResult
   startCustomActivity() ;
 }

//Code goes like :
Class MainActivity extends Activity{

 startCustomActivity()
 {

 if( <Condition1>) {
       Intent subIntent = new Intent();
 
subIntent.setClassName(getApplicationContext(),"com.android.SubActivity");
 subIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
 startActvityForResult(subIntent);
startActivityForResult(subIntent,Constant.REQUEST_SUB_SCREEN);  //
REQUEST_SUB_SCREEN = 20;
  }

else if (<Condition 2>) {
  //start activity 2
 startActivityForResult(,..,..,);
}

else if (<Condition3>) {
   //start activity 3
 startActivityForResult(,..,..,);
}


else if (<Condition 4>) {
   //start activity 4

}

}

onActivtyResult(,..,..,)
{
   if(requestCode == Constant.REQUEST_SUB_SCREEN)
   {
        if(responseCode == RESULT_OK)
        {
            startCustomActivity(getIntent().getAction(), getIntent());
        }
   }
}

AndroidManifest.xml

<activity android:name="com.android.SubActivity"
                        android:theme="@android:style/
Theme.Translucent.NoTitleBar.Fullscreen"
                        android:screenOrientation="sensor" 
android:label="@string/
app_name1"
                        android:icon="@drawable/qo"
                  <!--    android:noHistory = true  this is not
working as well -->
                          >

                <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category
android:name="android.intent.category.DEFAULT" />
            </intent-filter>
                </activity>


SubActivity.java
//Here on GoBack button, I want to send control back to calling
Activity ii.e. MainActivity
/// code starts
GoBackButton.setOnClickListener(new OnClickListener() {
                        public void onClick(View arg0) {
                                setResult(RESULT_OK);
                                finish();   <---------------- causing
problem
                        }
                });

//code ends

Whats happening is ...

My control is going back to MainActiivty on pressing GOBack button,
but the problem is since I am finishing SubAcitivty in GoBackButton
itself, it takes some time for control to go back to
onActivityResult() and do remaining task and launch another activity
say Activity 2,
as a result of which on pressing GoBack button, for few seconds ,
homeScreen (device homescreen) is dispalyed and then later, my
activity2 gets launched.

I want to remove that delay between GoBack button and launch of
Activity2

I wan to end SubAcitivty as soon as user navigates away from this
activity and send back control to calling activity. I also tried
setting android:noHistory = true instead of calling finish() but
nothing is working.

Please help :(


-- 

3. is there any idea that files are only used by application those are stored on media card?

4. 3D Image

5. implementing bluetooth printer

6. Kik and Whatsup

7. [WTB] Gel Case White+WarnaWarni+screen protector buat LG Optimus One