michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include michael@0: #include "prthread.h" michael@0: #include "prinit.h" michael@0: #ifndef XP_OS2 michael@0: #include "private/pprmisc.h" michael@0: #include michael@0: #else michael@0: #include "primpl.h" michael@0: #include michael@0: #endif michael@0: michael@0: #define THREADS 10 michael@0: michael@0: michael@0: void michael@0: threadmain(void *_id) michael@0: { michael@0: int id = (int)_id; michael@0: int index; michael@0: michael@0: printf("thread %d alive\n", id); michael@0: for (index=0; index<10; index++) { michael@0: printf("thread %d yielding\n", id); michael@0: PR_Sleep(0); michael@0: printf("thread %d awake\n", id); michael@0: } michael@0: printf("thread %d dead\n", id); michael@0: michael@0: } michael@0: michael@0: int main(int argc, char **argv) michael@0: { michael@0: int index; michael@0: PRThread *a[THREADS]; michael@0: michael@0: PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 5); michael@0: PR_STDIO_INIT(); michael@0: michael@0: for (index=0; index