when creating a new thread with sceKernelCreateThread there is a initial stack
that you can give.as param
doest the newly created thread use this stack for malloc or does it use the global heap space
of the homebrew determine by the PSP_HEAP_SIZE_KB(-256);
Is there a IPC (inter process communication) mecanism that i can use if my first
thread ask my second thread to perform some work.
Is there a way for a thread to wait for a resource like a value of a variable
Is there a equivalent of a enter critical section all the process bloqued for example
on a list and just one process performing the update
The idea behind is a cache server for my pdf reader
he is started async with the main code and when i display the first page
i cache in asyn mode the page -1 and the page +1 so when the user want to go
to page 2 it is already loader and the rendering is immediate but to do this
i must protect the bitmap pointer with a critical section.
And the main thread must wait the cache server if the page is not already loaded
question about sceKernelCreateThread
-
- Posts: 203
- Joined: Sat Jul 05, 2008 8:03 am
i saw in the sdk this
semaid = sceKernelCreateSema("MyMutex", 0, 1, 1, 0);
*
* @param name - Specifies the name of the sema
* @param attr - Sema attribute flags (normally set to 0)
* @param initVal - Sema initial value
* @param maxVal - Sema maximum value
* @param option - Sema options (normally set to 0)
* @return A semaphore id
int sceKernelWaitSema(SceUID semaid, int signal, SceUInt *timeout);
what value for timeout must a give to wait only for the release of the semaphore
is saw also in the sdk this
mbxid = sceKernelCreateMbx("MyMessagebox", 0, NULL);
* @endcode
*
* @param name - Specifies the name of the mbx
* @param attr - Mbx attribute flags (normally set to 0)
* @param option - Mbx options (normally set to NULL)
* @return A messagebox id
Has someone a example using semaphore,messagebox on the psp
semaid = sceKernelCreateSema("MyMutex", 0, 1, 1, 0);
*
* @param name - Specifies the name of the sema
* @param attr - Sema attribute flags (normally set to 0)
* @param initVal - Sema initial value
* @param maxVal - Sema maximum value
* @param option - Sema options (normally set to 0)
* @return A semaphore id
int sceKernelWaitSema(SceUID semaid, int signal, SceUInt *timeout);
what value for timeout must a give to wait only for the release of the semaphore
is saw also in the sdk this
mbxid = sceKernelCreateMbx("MyMessagebox", 0, NULL);
* @endcode
*
* @param name - Specifies the name of the mbx
* @param attr - Mbx attribute flags (normally set to 0)
* @param option - Mbx options (normally set to NULL)
* @return A messagebox id
Has someone a example using semaphore,messagebox on the psp
-
- Posts: 203
- Joined: Sat Jul 05, 2008 8:03 am
-
- Posts: 203
- Joined: Sat Jul 05, 2008 8:03 am
thx as read in previous discussions the multi tasking iof psp s cooperatif and not preemptif
are all the api involve by this ?
if i pool for a system event or a message box does my main thread have cpu
i'm currently written a cache server for my pdf reader the idea behind is
start 2 threads. One handle the load and the cachin of pdf pages in fact in do
a rendering a create a raw ARGB buffer for the main code
So when the main code ask for page +1 or Page -1 the user has not to wait
when the page is not in cache i put the main thread in wait until the rendering is
done in the cache server
are all the api involve by this ?
if i pool for a system event or a message box does my main thread have cpu
i'm currently written a cache server for my pdf reader the idea behind is
start 2 threads. One handle the load and the cachin of pdf pages in fact in do
a rendering a create a raw ARGB buffer for the main code
So when the main code ask for page +1 or Page -1 the user has not to wait
when the page is not in cache i put the main thread in wait until the rendering is
done in the cache server
Yah threading is co-operative, this seems to surprise people cause it has been rammed down their throats how pre-emptive is the shiz, well tbh that is only true when you have other stuff on the device you have no control over, not really applicable to the PSP.
As for ensuring things thread correctly well probably I would put the caching thread at a higher priority as that will mostly be waiting for IO anyway, however if all you are doing is wanting to prefetch stuff then you can use async IO and do it in one thread.
As for ensuring things thread correctly well probably I would put the caching thread at a higher priority as that will mostly be waiting for IO anyway, however if all you are doing is wanting to prefetch stuff then you can use async IO and do it in one thread.
-
- Posts: 203
- Joined: Sat Jul 05, 2008 8:03 am
yes and no i must load the structure of the pdf a bunch of pointers but it is done once
the idea of 2 thread is i load the page asked and when this page is ready the main thread display it and ican navigate into the bitmap created. The cache server continue to prefetch page -1 and page +1 int the hope that the user will read the previous or next page.
The user ask page+1 it is directly available to rendering and the cache server preload -1 and +1 again etc....so even when the user read the current page in
background i preload page-1 and page+1
the idea of 2 thread is i load the page asked and when this page is ready the main thread display it and ican navigate into the bitmap created. The cache server continue to prefetch page -1 and page +1 int the hope that the user will read the previous or next page.
The user ask page+1 it is directly available to rendering and the cache server preload -1 and +1 again etc....so even when the user read the current page in
background i preload page-1 and page+1