summaryrefslogtreecommitdiff
path: root/create.c
diff options
context:
space:
mode:
authorrpj <rpj>1999-01-03 16:41:14 +0000
committerrpj <rpj>1999-01-03 16:41:14 +0000
commit5ab9f5892826bb1c4e45b4dcb2692d4eb2f813f1 (patch)
tree055390c239a2f7cefdde4360a5f0f0096be19930 /create.c
parent63d8161801576f3acd5169b472946f4a687c4728 (diff)
Mon Jan 4 11:23:40 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>bossom-merge-99-01-04bossom-merge-98-12-08
* all: No code changes, just cleanup. - remove #if 0 /* Pre Bossom */ enclosed code. - Remove some redundant #includes. * pthread.h: Update implemented/unimplemented routines list. * Tag the bossom merge branch getting ready to merge back to main trunk.
Diffstat (limited to 'create.c')
-rw-r--r--create.c144
1 files changed, 0 insertions, 144 deletions
diff --git a/create.c b/create.c
index 8f7142b..37e1c61 100644
--- a/create.c
+++ b/create.c
@@ -145,147 +145,3 @@ FAIL0:
/* </JEB> */
-
-#if 0 /* Pre Bossom */
-
-#include <errno.h>
-
-#include <windows.h>
-#include <process.h>
-#include <string.h>
-
-#include "pthread.h"
-#include "implement.h"
-
-unsigned
-STDCALL _pthread_start_call(void * us_arg)
-{
- /* We're now in a running thread. Any local variables here are on
- this thread's private stack so we're safe to leave data in them
- until we leave. */
- pthread_t us;
-
- /* FIXME: Needs to be a malloc(PTHREAD_KEYS_MAX) otherwise changing
- _PTHREAD_MAX_KEYS in a later version of the DLL will break older apps.
- */
- void * keys[_PTHREAD_MAX_KEYS];
-
- unsigned (*func)(void *);
- void * arg;
- unsigned ret;
-
- us = (pthread_t) us_arg;
-
- memset(keys, 0, sizeof(keys));
-
- (void) TlsSetValue(_pthread_threadID_TlsIndex, (LPVOID) us);
- (void) TlsSetValue(_pthread_TSD_keys_TlsIndex, (LPVOID) keys);
-
- /* FIXME: For now, if priority setting fails then at least ensure
- that our records reflect true reality. */
- if (SetThreadPriority((HANDLE) us->win32handle, us->attr.priority) == FALSE)
- {
- us->attr.priority = GetThreadPriority((HANDLE) us->win32handle);
- }
-
- func = us->call.routine;
- arg = us->call.arg;
-
- ret = (*func)(arg);
-
- _pthread_exit(us, NULL, ret);
-
- /* Never Reached */
- return 0;
-}
-
-int
-pthread_create(pthread_t *thread,
- const pthread_attr_t *attr,
- void * (*start_routine) (void *),
- void * arg)
-{
- HANDLE handle = (HANDLE) NULL;
- unsigned flags;
- void * security = NULL;
- DWORD threadID;
- pthread_attr_t * attr_copy;
- pthread_t new_thread;
- /* Success unless otherwise set. */
- int ret;
-
- /* CRITICAL SECTION */
- pthread_mutex_lock(&_pthread_table_mutex);
-
- ret = _pthread_new_thread(&new_thread);
-
- pthread_mutex_unlock(&_pthread_table_mutex);
- /* END CRITICAL SECTION */
-
- if (ret == 0)
- {
- attr_copy = &(new_thread->attr);
-
- /* Map given attributes otherwise just use default values. */
- if (attr != NULL)
- {
- if (attr_copy->stacksize == 0)
- {
- attr_copy->stacksize = PTHREAD_STACK_MIN;
- }
-
- attr_copy->detachstate = attr->detachstate;
- attr_copy->priority = attr->priority;
-
-#if HAVE_SIGSET_T
- memcpy(&(attr_copy->sigmask), &(attr->sigmask), sizeof(sigset_t));
-#endif /* HAVE_SIGSET_T */
- }
-
- /* We call a generic wrapper which then calls the start routine. */
- new_thread->call.routine = (unsigned (*)(void *)) start_routine;
- new_thread->call.arg = arg;
-
- /* Start running, not suspended. */
- flags = 0;
-
- handle = (HANDLE) _beginthreadex(security,
- attr_copy->stacksize,
- _pthread_start_call,
- (void *) new_thread,
- flags,
- &threadID);
-
- if (handle == (HANDLE) NULL)
- {
- ret = EAGAIN;
- }
- }
- else
- {
- ret = EAGAIN;
- }
-
- if (ret == 0)
- {
- /* Let the caller know the thread handle. */
- new_thread->win32handle = handle;
- new_thread->ptstatus = _PTHREAD_INUSE;
- *thread = new_thread;
- }
- else
- {
- /* CRITICAL SECTION */
- pthread_mutex_lock(&_pthread_table_mutex);
-
- /* Remove the failed thread entry. */
- _pthread_delete_thread(new_thread);
-
- pthread_mutex_unlock(&_pthread_table_mutex);
- /* END CRITICAL SECTION */
- }
-
- return ret;
-}
-
-#endif /* Pre Bossom */