 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Noko
Joined: 06 Sep 2008 Posts: 23
|
Posted: Fri Oct 10, 2008 6:31 pm Post subject: sceIoOpen and sceIoOpenAsync |
|
|
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 |
|
 |
[wl]
Joined: 05 May 2006 Posts: 16
|
Posted: Fri Oct 10, 2008 10:24 pm Post subject: |
|
|
| sceIoOpenAsync should help, because commercial games uses it while decoding/playing audio and video |
|
| Back to top |
|
 |
Noko
Joined: 06 Sep 2008 Posts: 23
|
Posted: Sat Oct 11, 2008 5:24 am Post subject: |
|
|
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 |
|
 |
moonlight
Joined: 26 Oct 2005 Posts: 567
|
Posted: Sat Oct 11, 2008 6:37 am Post subject: |
|
|
| 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 |
|
 |
|
|
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
|