forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

sceIoOpen and sceIoOpenAsync

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Noko



Joined: 06 Sep 2008
Posts: 23

PostPosted: Fri Oct 10, 2008 6:31 pm    Post subject: sceIoOpen and sceIoOpenAsync Reply with quote

sceIoOpen and sceIoOpenAsync
Are there real differences? Or can this whole async stuff be emulated using non-async functions?
I'm asking this because apparently psp kernel is not reentrant, and when I call sceIoRead with a lot of bytes to read, syscalls from other threads (like reading psp joystick state) seem to block until reading from file is done. I though that maybe async i/o might be a solution for this.
Back to top
View user's profile Send private message
[wl]



Joined: 05 May 2006
Posts: 16

PostPosted: Fri Oct 10, 2008 10:24 pm    Post subject: Reply with quote

sceIoOpenAsync should help, because commercial games uses it while decoding/playing audio and video
Back to top
View user's profile Send private message
Noko



Joined: 06 Sep 2008
Posts: 23

PostPosted: Sat Oct 11, 2008 5:24 am    Post subject: Reply with quote

Did someone here use async file io?

I'm doing something like this:
Code:
   SceUID f;
   SceInt64 asyncres;

   if((f=sceIoOpenAsync(path,PSP_O_RDONLY,0777))<0)
      return NULL;

   sceIoReadAsync(f,buffer,bufsize);
   sceIoWaitAsync(f,&asyncres);


Where to get the amount of bytes read after that? You'd think it would be in asyncres, but asyncres has the same values as f for some reason.
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Sat Oct 11, 2008 6:37 am    Post subject: Reply with quote

Noko wrote:
Did someone here use async file io?

I'm doing something like this:
Code:
   SceUID f;
   SceInt64 asyncres;

   if((f=sceIoOpenAsync(path,PSP_O_RDONLY,0777))<0)
      return NULL;

   sceIoReadAsync(f,buffer,bufsize);
       sceIoWaitAsync(f,&asyncres);


Where to get the amount of bytes read after that? You'd think it would be in asyncres, but asyncres has the same values as f for some reason.


Shouldn't you wait also for sceIoOpenAsync completion?
Even if openasync returns success and a valid fd, that doesn't mean it completed the opening.

Code:
   SceUID f;
   SceInt64 asyncres;

   if((f=sceIoOpenAsync(path,PSP_O_RDONLY,0777))<0)
      return NULL;

       sceIoWaitAsync(f, &asyncres);
        if (asyncres < 0)
            return NULL;

        sceIoReadAsync(f,buffer,bufsize);
      sceIoWaitAsync(f,&asyncres);
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group