-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Decouple thread startup from thread creation (#72)
* Have the `CREATE_THREAD` system call bind the thread it creates to a descriptor. * Decouple starting a thread (`START_THREAD`) from creating a thread (`CREATE_THREAD`). This way, a process can be given the permissions needed to manage a thread pool but not to create threads itself, to allow a system service to control resource usage. * Add `JOIN_THREAD` system call.
- Loading branch information
1 parent
38c57db
commit ce60c73
Showing
54 changed files
with
954 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,39 @@ | ||
# EXIT_THREAD - Exit the Current Thread | ||
# EXIT_THREAD - Terminate the Current Thread | ||
|
||
## Description | ||
|
||
Exit the current thread. | ||
Terminate the current thread. | ||
|
||
## Arguments | ||
|
||
Function number (`arg0`) is 12. | ||
|
||
``` | ||
+----------------------------------------------------------------+ | ||
| function = 12 | arg0 | ||
+----------------------------------------------------------------+ | ||
31 0 | ||
+----------------------------------------------------------------+ | ||
| reserved (0) | arg1 | ||
+----------------------------------------------------------------+ | ||
31 0 | ||
+----------------------------------------------------------------+ | ||
| reserved (0) | arg2 | ||
+----------------------------------------------------------------+ | ||
31 0 | ||
+----------------------------------------------------------------+ | ||
| reserved (0) | arg3 | ||
+----------------------------------------------------------------+ | ||
31 0 | ||
``` | ||
|
||
## Return Value | ||
|
||
This function exits the current thread and does not return. | ||
This function terminates the current thread and does not return. | ||
|
||
## Errors | ||
|
||
This function always succeeds. | ||
|
||
## Future Direction | ||
|
||
The current system call only affects the current thread. It may be changed or | ||
some other function may be added to allow another thread to be destroyed, in | ||
which case the thread would be specified using a descriptor. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# JOIN_THREAD - Wait for a Thread to Exit | ||
|
||
## Description | ||
|
||
Wait for a thread to terminate, if it hasn't already. | ||
|
||
The target thread must have been started with [START_THREAD](start-thread.md) | ||
and must not be the calling thread. Furthermore, this function must be called | ||
at most once on a given thread since it has been started. | ||
|
||
For this operation to succeed, the thread descriptor must have the | ||
[JINUE_PERM_JOIN](../../include/jinue/shared/asm/permissions.h) permission. | ||
|
||
## Arguments | ||
|
||
Function number (`arg0`) is 21. | ||
|
||
The descriptor number for the thread is set in `arg1`. | ||
|
||
``` | ||
+----------------------------------------------------------------+ | ||
| function = 21 | arg0 | ||
+----------------------------------------------------------------+ | ||
31 0 | ||
+----------------------------------------------------------------+ | ||
| thread descriptor number | arg1 | ||
+----------------------------------------------------------------+ | ||
31 0 | ||
+----------------------------------------------------------------+ | ||
| reserved (0) | arg2 | ||
+----------------------------------------------------------------+ | ||
31 0 | ||
+----------------------------------------------------------------+ | ||
| reserved (0) | arg3 | ||
+----------------------------------------------------------------+ | ||
31 0 | ||
``` | ||
|
||
## Return Value | ||
|
||
On success, this function returns 0 (in `arg0`). On failure, this function | ||
returns -1 and an error number is set (in `arg1`). | ||
|
||
## Errors | ||
|
||
* JINUE_EBADF if the thread descriptor is invalid, or does not refer to a | ||
thread, or is closed. | ||
* JINUE_ESRCH if the thread has not been started or has already beed joined. | ||
* JINUE_EDEADLK if a thread attempts to join itself. | ||
* JINUE_EPERM if the specified thread descriptor does not have the permission | ||
to join the thread. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.