mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +00:00
Make some improvements of little consequence
This commit is contained in:
parent
690d3df66e
commit
18a620cc1a
11 changed files with 92 additions and 14 deletions
|
@ -34,6 +34,8 @@
|
|||
* @see pthread_attr_setschedpolicy()
|
||||
* @see pthread_attr_setinheritsched()
|
||||
* @see pthread_attr_setscope()
|
||||
* @see pthread_attr_setsigaltstack_np()
|
||||
* @see pthread_attr_setsigaltstacksize_np()
|
||||
*/
|
||||
errno_t pthread_attr_init(pthread_attr_t *attr) {
|
||||
*attr = (pthread_attr_t){
|
||||
|
|
|
@ -354,6 +354,7 @@ static errno_t _pthread_cancel_everyone(void) {
|
|||
*/
|
||||
errno_t pthread_cancel(pthread_t thread) {
|
||||
struct PosixThread *arg;
|
||||
unassert(thread);
|
||||
if ((arg = (struct PosixThread *)thread)) {
|
||||
return _pthread_cancel_single(arg);
|
||||
} else {
|
||||
|
|
|
@ -62,6 +62,7 @@ static errno_t pthread_detach_impl(struct PosixThread *pt) {
|
|||
* @returnserrno
|
||||
*/
|
||||
errno_t pthread_detach(pthread_t thread) {
|
||||
unassert(thread);
|
||||
struct PosixThread *pt = (struct PosixThread *)thread;
|
||||
errno_t err = pthread_detach_impl(pt);
|
||||
STRACE("pthread_detach(%d) → %s", _pthread_tid(pt), DescribeErrno(err));
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/assert.h"
|
||||
#include "libc/calls/sched-sysv.internal.h"
|
||||
#include "libc/calls/struct/cpuset.h"
|
||||
#include "libc/dce.h"
|
||||
|
@ -39,6 +40,8 @@
|
|||
errno_t pthread_getaffinity_np(pthread_t thread, size_t size,
|
||||
cpu_set_t *bitset) {
|
||||
int rc, tid;
|
||||
unassert(thread);
|
||||
unassert(bitset);
|
||||
tid = _pthread_tid((struct PosixThread *)thread);
|
||||
|
||||
if (size != sizeof(cpu_set_t)) {
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/assert.h"
|
||||
#include "libc/calls/sched-sysv.internal.h"
|
||||
#include "libc/calls/struct/cpuset.h"
|
||||
#include "libc/calls/syscall_support-nt.internal.h"
|
||||
|
@ -54,6 +55,8 @@ errno_t pthread_setaffinity_np(pthread_t thread, size_t size,
|
|||
int e, rc, tid;
|
||||
cpu_set_t bs = {0};
|
||||
struct PosixThread *pt;
|
||||
unassert(thread);
|
||||
unassert(bitset);
|
||||
e = errno;
|
||||
if (size < sizeof(cpu_set_t)) {
|
||||
memcpy(&bs, bitset, size);
|
||||
|
|
|
@ -118,6 +118,7 @@ errno_t pthread_timedjoin_np(pthread_t thread, void **value_ptr,
|
|||
struct PosixThread *pt;
|
||||
enum PosixThreadStatus status;
|
||||
pt = (struct PosixThread *)thread;
|
||||
unassert(thread);
|
||||
|
||||
// "The behavior is undefined if the value specified by the thread
|
||||
// argument to pthread_join() does not refer to a joinable thread."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue