public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
* It doesn't work: using pthread_win32 library installation with MSVC++6
@ 2002-01-23  2:02 oliver.kramer
  2002-01-23 12:59 ` Philipp Krause
  2002-01-23 16:14 ` It doesn't work: using pthread_win32 library installation withMSVC++6 Ross Johnson
  0 siblings, 2 replies; 4+ messages in thread
From: oliver.kramer @ 2002-01-23  2:02 UTC (permalink / raw)
  To: pthreads-win32



I read all the readable files. I followed all the instructions given in any
files. Even I recompile the sources but all i get is:

c:\programme\microsoft visual studio\vc98\include\rpcasync.h(45) : warning
C4115: '_RPC_ASYNC_STATE' : Benannte Typdefinition in runden Klammern
d:\threads\examples\signals\stat_sigwait.c(33) : error C2065: 'sigset_t' :
nichtdeklarierter Bezeichner
d:\threads\examples\signals\stat_sigwait.c(33) : error C2146: Syntaxfehler :
Fehlendes ';' vor Bezeichner 'sigs_to_catch'
d:\threads\examples\signals\stat_sigwait.c(33) : error C2065: 'sigs_to_catch' :
nichtdeklarierter Bezeichner
d:\threads\examples\signals\stat_sigwait.c(47) : warning C4013: 'sigemptyset'
undefiniert; Annahme: extern mit Rueckgabetyp int
d:\threads\examples\signals\stat_sigwait.c(48) : warning C4013: 'sigaddset'
undefiniert; Annahme: extern mit Rueckgabetyp int
d:\threads\examples\signals\stat_sigwait.c(48) : error C2065: 'SIGUSR1' :
nichtdeklarierter Bezeichner
d:\threads\examples\signals\stat_sigwait.c(51) : warning C4013: 'sigwait'
undefiniert; Annahme: extern mit Rueckgabetyp int
d:\threads\examples\signals\stat_sigwait.c(77) : warning C4013: 'sleep'
undefiniert; Annahme: extern mit Rueckgabetyp int
d:\threads\examples\signals\stat_sigwait.c(97) : error C2146: Syntaxfehler :
Fehlendes ';' vor Bezeichner 'sigs_to_block'
d:\threads\examples\signals\stat_sigwait.c(97) : error C2065: 'sigs_to_block' :
nichtdeklarierter Bezeichner
d:\threads\examples\signals\stat_sigwait.c(98) : error C2143: Syntaxfehler :
Fehlendes ';' vor 'type'
d:\threads\examples\signals\stat_sigwait.c(110) : warning C4013:
'pthread_sigmask' undefiniert; Annahme: extern mit Rueckgabetyp int
Fehler beim Ausführen von cl.exe.

SIGNAL.exe - 7 Fehler, 6 Warnung(en)

After reading all the relevant postings in the whole usenet .... - please help!
What's going wrong? Urgent!

Oliver


I tried to compile an example from "Pthread programming" (O'Reilly) =>
stat_sig_wait.c:

/********************************************************
 * An example source module to accompany...
 *
 * "Using POSIX Threads: Programming with Pthreads"
 *     by Brad nichols, Dick Buttlar, Jackie Farrell
 *     O'Reilly & Associates, Inc.
 *
 ********************************************************
 * stat_sigwait.c
 *
 * Simple example of pthreads and signals.
 */

#include <stdlib.h>
#include <stdio.h>
// #include <unistd.h>
#include <io.h>

#include <signal.h>
#include <time.h>
#include <sys/types.h>

#include <pthread.h>

#define MAX_NUM_THREADS  10

pthread_mutex_t stats_lock = PTHREAD_MUTEX_INITIALIZER;
int mean, samples, total;

void *report_stats(void *p)
{
  int caught;
  sigset_t  sigs_to_catch;

  /* Identify our thread */
  printf("\nreport_stats() started.\n");

  /*
   * We inherited a thread sigmask with all the signals
   * blocked.  So, we can wait on whatever signals we're
   * interested in and (as long as no other thread waits
   * for them) we'll be sure return from sigwait() to
   * handle it.
   */

  /* set this thread's signal mask to block out SIGUSR1 */
  sigemptyset(&sigs_to_catch);
  sigaddset(&sigs_to_catch, SIGUSR1);

  for (;;) {
     sigwait(&sigs_to_catch, &caught);

     pthread_mutex_lock(&stats_lock);
     mean = total/samples;
     printf("\nreport_stats(): mean = %d, samples = %d\n", mean, samples);
     pthread_mutex_unlock(&stats_lock);
  }
  return NULL;
}
/*
 * worker_thread --
 *
 * Don't read too much into what this thread does.  It's
 * a very simpleminded example.  The only interesting thing
 * it does is write to the global statistics data-- which
 * means the thread processing the signal has to protect
 * against simultaneous access.
 */
void *worker_thread(void *p)
{
int item;
time_t now;
int *amtp=(int *)p;

  for (;;) {

    sleep((*amtp)*9);

    now = time(NULL);

    pthread_mutex_lock(&stats_lock);
    total+=((int)now)%60; /* probably not the safest thing to do but
                  it's just an example */
    samples++;
    pthread_mutex_unlock(&stats_lock);
  }
  /* Won't get here.  */
  return NULL;
}

extern int
main(void)
{
  int       i;
  pthread_t threads[MAX_NUM_THREADS];
  int       num_threads = 0;
  sigset_t  sigs_to_block;
  struct    sigaction action;


  /* Identify our thread */
  printf("main() running in thread 0x%x\n", pthread_self());

  /*
   * Set this thread's signal mask to block SIGUSR1
   * Other thread's will inherit the mask
   */
  sigemptyset(&sigs_to_block);
  sigaddset(&sigs_to_block, SIGUSR1);
  pthread_sigmask(SIG_BLOCK, &sigs_to_block, NULL);

  /* spawn statistics reporting thread */
  pthread_create(&threads[num_threads++],
              NULL,
           report_stats,
           NULL);

  /* spawn the threads */
  for (i=num_threads; i<MAX_NUM_THREADS; i++) {
    pthread_create(&threads[num_threads++],
             NULL,
                   worker_thread,
             &i);
  }

  printf("main()\t\t\t\t%d threads created\n",num_threads);

  /* wait until all threads have finished */
  for (i = 0; i < num_threads; i++) {
    pthread_join(threads[i], NULL);
    printf("main()\t\tjoined to thread %d \n", i);
  }

  printf("main()\t\tall %d threads have finished. \n", num_threads);

  return 0;
}


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: It doesn't work: using pthread_win32 library installation with  MSVC++6
  2002-01-23  2:02 It doesn't work: using pthread_win32 library installation with MSVC++6 oliver.kramer
@ 2002-01-23 12:59 ` Philipp Krause
  2002-01-23 16:14 ` It doesn't work: using pthread_win32 library installation withMSVC++6 Ross Johnson
  1 sibling, 0 replies; 4+ messages in thread
From: Philipp Krause @ 2002-01-23 12:59 UTC (permalink / raw)
  To: oliver.kramer; +Cc: pthreads-win32

oliver.kramer@ferrero.de wrote:

>
>I read all the readable files. I followed all the instructions given in any
>files. Even I recompile the sources but all i get is:
>
>c:\programme\microsoft visual studio\vc98\include\rpcasync.h(45) : warning
>C4115: '_RPC_ASYNC_STATE' : Benannte Typdefinition in runden Klammern
>d:\threads\examples\signals\stat_sigwait.c(33) : error C2065: 'sigset_t' :
>nichtdeklarierter Bezeichner
>d:\threads\examples\signals\stat_sigwait.c(33) : error C2146: Syntaxfehler :
>Fehlendes ';' vor Bezeichner 'sigs_to_catch'
>d:\threads\examples\signals\stat_sigwait.c(33) : error C2065: 'sigs_to_catch' :
>nichtdeklarierter Bezeichner
>d:\threads\examples\signals\stat_sigwait.c(47) : warning C4013: 'sigemptyset'
>undefiniert; Annahme: extern mit Rueckgabetyp int
>d:\threads\examples\signals\stat_sigwait.c(48) : warning C4013: 'sigaddset'
>undefiniert; Annahme: extern mit Rueckgabetyp int
>d:\threads\examples\signals\stat_sigwait.c(48) : error C2065: 'SIGUSR1' :
>nichtdeklarierter Bezeichner
>d:\threads\examples\signals\stat_sigwait.c(51) : warning C4013: 'sigwait'
>undefiniert; Annahme: extern mit Rueckgabetyp int
>d:\threads\examples\signals\stat_sigwait.c(77) : warning C4013: 'sleep'
>undefiniert; Annahme: extern mit Rueckgabetyp int
>d:\threads\examples\signals\stat_sigwait.c(97) : error C2146: Syntaxfehler :
>Fehlendes ';' vor Bezeichner 'sigs_to_block'
>d:\threads\examples\signals\stat_sigwait.c(97) : error C2065: 'sigs_to_block' :
>nichtdeklarierter Bezeichner
>d:\threads\examples\signals\stat_sigwait.c(98) : error C2143: Syntaxfehler :
>Fehlendes ';' vor 'type'
>d:\threads\examples\signals\stat_sigwait.c(110) : warning C4013:
>'pthread_sigmask' undefiniert; Annahme: extern mit Rueckgabetyp int
>Fehler beim Ausführen von cl.exe.
>
>SIGNAL.exe - 7 Fehler, 6 Warnung(en)
>
You're trying to use signals, which don't exist on Win32. The problem 
are these, not the pthreads stuff you use.

Philipp Krause


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: It doesn't work: using pthread_win32 library installation  withMSVC++6
  2002-01-23  2:02 It doesn't work: using pthread_win32 library installation with MSVC++6 oliver.kramer
  2002-01-23 12:59 ` Philipp Krause
@ 2002-01-23 16:14 ` Ross Johnson
  2002-01-24  5:44   ` Win32 Signals Panagiotis E. Hadjidoukas
  1 sibling, 1 reply; 4+ messages in thread
From: Ross Johnson @ 2002-01-23 16:14 UTC (permalink / raw)
  To: oliver.kramer; +Cc: pthreads-win32

Hi Oliver,

The problem is that pthreads-win32 doesn't provide POSIX signals,
only those parts of the POSIX standard that relate closely to threads
(excepting those which can't be implementated on Win32 - yet).

If you need Signals then you should look at the CygWin project, which
aims to provide a much more complete Unix/POSIX API on Win32. I'm not
sure how complete the threads support is, but they have been doing a
lot of work on it over the last 12 months.

http://sources.redhat.com/cygwin
http://cygwin.com/licensing.html

Another possibility is the UWin project from AT&T.

http://www.research.att.com/sw/tools/uwin/

Hope this helps.
Ross

oliver.kramer@ferrero.de wrote:
> 
> I read all the readable files. I followed all the instructions given in any
> files. Even I recompile the sources but all i get is:
> 
> c:\programme\microsoft visual studio\vc98\include\rpcasync.h(45) : warning
> C4115: '_RPC_ASYNC_STATE' : Benannte Typdefinition in runden Klammern
> d:\threads\examples\signals\stat_sigwait.c(33) : error C2065: 'sigset_t' :
> nichtdeklarierter Bezeichner
> d:\threads\examples\signals\stat_sigwait.c(33) : error C2146: Syntaxfehler :
> Fehlendes ';' vor Bezeichner 'sigs_to_catch'
> d:\threads\examples\signals\stat_sigwait.c(33) : error C2065: 'sigs_to_catch' :
> nichtdeklarierter Bezeichner
> d:\threads\examples\signals\stat_sigwait.c(47) : warning C4013: 'sigemptyset'
> undefiniert; Annahme: extern mit Rueckgabetyp int
> d:\threads\examples\signals\stat_sigwait.c(48) : warning C4013: 'sigaddset'
> undefiniert; Annahme: extern mit Rueckgabetyp int
> d:\threads\examples\signals\stat_sigwait.c(48) : error C2065: 'SIGUSR1' :
> nichtdeklarierter Bezeichner
> d:\threads\examples\signals\stat_sigwait.c(51) : warning C4013: 'sigwait'
> undefiniert; Annahme: extern mit Rueckgabetyp int
> d:\threads\examples\signals\stat_sigwait.c(77) : warning C4013: 'sleep'
> undefiniert; Annahme: extern mit Rueckgabetyp int
> d:\threads\examples\signals\stat_sigwait.c(97) : error C2146: Syntaxfehler :
> Fehlendes ';' vor Bezeichner 'sigs_to_block'
> d:\threads\examples\signals\stat_sigwait.c(97) : error C2065: 'sigs_to_block' :
> nichtdeklarierter Bezeichner
> d:\threads\examples\signals\stat_sigwait.c(98) : error C2143: Syntaxfehler :
> Fehlendes ';' vor 'type'
> d:\threads\examples\signals\stat_sigwait.c(110) : warning C4013:
> 'pthread_sigmask' undefiniert; Annahme: extern mit Rueckgabetyp int
> Fehler beim Ausführen von cl.exe.
> 
> SIGNAL.exe - 7 Fehler, 6 Warnung(en)
> 
> After reading all the relevant postings in the whole usenet .... - please help!
> What's going wrong? Urgent!
> 
> Oliver
> 
> I tried to compile an example from "Pthread programming" (O'Reilly) =>
> stat_sig_wait.c:
> 
> /********************************************************
>  * An example source module to accompany...
>  *
>  * "Using POSIX Threads: Programming with Pthreads"
>  *     by Brad nichols, Dick Buttlar, Jackie Farrell
>  *     O'Reilly & Associates, Inc.
>  *
>  ********************************************************
>  * stat_sigwait.c
>  *
>  * Simple example of pthreads and signals.
>  */
> 
> #include <stdlib.h>
> #include <stdio.h>
> // #include <unistd.h>
> #include <io.h>
> 
> #include <signal.h>
> #include <time.h>
> #include <sys/types.h>
> 
> #include <pthread.h>
> 
> #define MAX_NUM_THREADS  10
> 
> pthread_mutex_t stats_lock = PTHREAD_MUTEX_INITIALIZER;
> int mean, samples, total;
> 
> void *report_stats(void *p)
> {
>   int caught;
>   sigset_t  sigs_to_catch;
> 
>   /* Identify our thread */
>   printf("\nreport_stats() started.\n");
> 
>   /*
>    * We inherited a thread sigmask with all the signals
>    * blocked.  So, we can wait on whatever signals we're
>    * interested in and (as long as no other thread waits
>    * for them) we'll be sure return from sigwait() to
>    * handle it.
>    */
> 
>   /* set this thread's signal mask to block out SIGUSR1 */
>   sigemptyset(&sigs_to_catch);
>   sigaddset(&sigs_to_catch, SIGUSR1);
> 
>   for (;;) {
>      sigwait(&sigs_to_catch, &caught);
> 
>      pthread_mutex_lock(&stats_lock);
>      mean = total/samples;
>      printf("\nreport_stats(): mean = %d, samples = %d\n", mean, samples);
>      pthread_mutex_unlock(&stats_lock);
>   }
>   return NULL;
> }
> /*
>  * worker_thread --
>  *
>  * Don't read too much into what this thread does.  It's
>  * a very simpleminded example.  The only interesting thing
>  * it does is write to the global statistics data-- which
>  * means the thread processing the signal has to protect
>  * against simultaneous access.
>  */
> void *worker_thread(void *p)
> {
> int item;
> time_t now;
> int *amtp=(int *)p;
> 
>   for (;;) {
> 
>     sleep((*amtp)*9);
> 
>     now = time(NULL);
> 
>     pthread_mutex_lock(&stats_lock);
>     total+=((int)now)%60; /* probably not the safest thing to do but
>                   it's just an example */
>     samples++;
>     pthread_mutex_unlock(&stats_lock);
>   }
>   /* Won't get here.  */
>   return NULL;
> }
> 
> extern int
> main(void)
> {
>   int       i;
>   pthread_t threads[MAX_NUM_THREADS];
>   int       num_threads = 0;
>   sigset_t  sigs_to_block;
>   struct    sigaction action;
> 
>   /* Identify our thread */
>   printf("main() running in thread 0x%x\n", pthread_self());
> 
>   /*
>    * Set this thread's signal mask to block SIGUSR1
>    * Other thread's will inherit the mask
>    */
>   sigemptyset(&sigs_to_block);
>   sigaddset(&sigs_to_block, SIGUSR1);
>   pthread_sigmask(SIG_BLOCK, &sigs_to_block, NULL);
> 
>   /* spawn statistics reporting thread */
>   pthread_create(&threads[num_threads++],
>               NULL,
>            report_stats,
>            NULL);
> 
>   /* spawn the threads */
>   for (i=num_threads; i<MAX_NUM_THREADS; i++) {
>     pthread_create(&threads[num_threads++],
>              NULL,
>                    worker_thread,
>              &i);
>   }
> 
>   printf("main()\t\t\t\t%d threads created\n",num_threads);
> 
>   /* wait until all threads have finished */
>   for (i = 0; i < num_threads; i++) {
>     pthread_join(threads[i], NULL);
>     printf("main()\t\tjoined to thread %d \n", i);
>   }
> 
>   printf("main()\t\tall %d threads have finished. \n", num_threads);
> 
>   return 0;
> }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Win32 Signals
  2002-01-23 16:14 ` It doesn't work: using pthread_win32 library installation withMSVC++6 Ross Johnson
@ 2002-01-24  5:44   ` Panagiotis E. Hadjidoukas
  0 siblings, 0 replies; 4+ messages in thread
From: Panagiotis E. Hadjidoukas @ 2002-01-24  5:44 UTC (permalink / raw)
  To: pthreads-win32

[-- Attachment #1: Type: text/plain, Size: 7408 bytes --]

Hi all,

For Unix-like and user-defined signals (like SIGUSR1) 
on native Windows NT/2000, have you ever considered 
the idea described in this article?

Windows Developer's Journal
August 2001, Volume 12, Number 08
"A Device Driver for W2K Signals"
http://www.wdj.com/articles/2001/0108/0108toc.htm?topic=articles

Panagiotis

------------------------------------
Panagiotis E. Hadjidoukas
Ph.D Student
High Performance Information Systems Laboratory
Computer Enginnering & Informatics Department
University of Patras, Greece

Contact
e-mail: peh@hpclab.ceid.upatras.gr
work:   +30 61993805
fax:    +30 61997706
http://www.hpclab.ceid.upatras.gr




----- Original Message ----- 
From: "Ross Johnson" <rpj@ise.canberra.edu.au>
To: <oliver.kramer@ferrero.de>
Cc: <pthreads-win32@sources.redhat.com>
Sent: Thursday, January 24, 2002 2:07 PM
Subject: Re: It doesn't work: using pthread_win32 library installation withMSVC++6


Hi Oliver,

The problem is that pthreads-win32 doesn't provide POSIX signals,
only those parts of the POSIX standard that relate closely to threads
(excepting those which can't be implementated on Win32 - yet).

If you need Signals then you should look at the CygWin project, which
aims to provide a much more complete Unix/POSIX API on Win32. I'm not
sure how complete the threads support is, but they have been doing a
lot of work on it over the last 12 months.

http://sources.redhat.com/cygwin
http://cygwin.com/licensing.html

Another possibility is the UWin project from AT&T.

http://www.research.att.com/sw/tools/uwin/

Hope this helps.
Ross

oliver.kramer@ferrero.de wrote:
> 
> I read all the readable files. I followed all the instructions given in any
> files. Even I recompile the sources but all i get is:
> 
> c:\programme\microsoft visual studio\vc98\include\rpcasync.h(45) : warning
> C4115: '_RPC_ASYNC_STATE' : Benannte Typdefinition in runden Klammern
> d:\threads\examples\signals\stat_sigwait.c(33) : error C2065: 'sigset_t' :
> nichtdeklarierter Bezeichner
> d:\threads\examples\signals\stat_sigwait.c(33) : error C2146: Syntaxfehler :
> Fehlendes ';' vor Bezeichner 'sigs_to_catch'
> d:\threads\examples\signals\stat_sigwait.c(33) : error C2065: 'sigs_to_catch' :
> nichtdeklarierter Bezeichner
> d:\threads\examples\signals\stat_sigwait.c(47) : warning C4013: 'sigemptyset'
> undefiniert; Annahme: extern mit Rueckgabetyp int
> d:\threads\examples\signals\stat_sigwait.c(48) : warning C4013: 'sigaddset'
> undefiniert; Annahme: extern mit Rueckgabetyp int
> d:\threads\examples\signals\stat_sigwait.c(48) : error C2065: 'SIGUSR1' :
> nichtdeklarierter Bezeichner
> d:\threads\examples\signals\stat_sigwait.c(51) : warning C4013: 'sigwait'
> undefiniert; Annahme: extern mit Rueckgabetyp int
> d:\threads\examples\signals\stat_sigwait.c(77) : warning C4013: 'sleep'
> undefiniert; Annahme: extern mit Rueckgabetyp int
> d:\threads\examples\signals\stat_sigwait.c(97) : error C2146: Syntaxfehler :
> Fehlendes ';' vor Bezeichner 'sigs_to_block'
> d:\threads\examples\signals\stat_sigwait.c(97) : error C2065: 'sigs_to_block' :
> nichtdeklarierter Bezeichner
> d:\threads\examples\signals\stat_sigwait.c(98) : error C2143: Syntaxfehler :
> Fehlendes ';' vor 'type'
> d:\threads\examples\signals\stat_sigwait.c(110) : warning C4013:
> 'pthread_sigmask' undefiniert; Annahme: extern mit Rueckgabetyp int
> Fehler beim Ausführen von cl.exe.
> 
> SIGNAL.exe - 7 Fehler, 6 Warnung(en)
> 
> After reading all the relevant postings in the whole usenet .... - please help!
> What's going wrong? Urgent!
> 
> Oliver
> 
> I tried to compile an example from "Pthread programming" (O'Reilly) =>
> stat_sig_wait.c:
> 
> /********************************************************
>  * An example source module to accompany...
>  *
>  * "Using POSIX Threads: Programming with Pthreads"
>  *     by Brad nichols, Dick Buttlar, Jackie Farrell
>  *     O'Reilly & Associates, Inc.
>  *
>  ********************************************************
>  * stat_sigwait.c
>  *
>  * Simple example of pthreads and signals.
>  */
> 
> #include <stdlib.h>
> #include <stdio.h>
> // #include <unistd.h>
> #include <io.h>
> 
> #include <signal.h>
> #include <time.h>
> #include <sys/types.h>
> 
> #include <pthread.h>
> 
> #define MAX_NUM_THREADS  10
> 
> pthread_mutex_t stats_lock = PTHREAD_MUTEX_INITIALIZER;
> int mean, samples, total;
> 
> void *report_stats(void *p)
> {
>   int caught;
>   sigset_t  sigs_to_catch;
> 
>   /* Identify our thread */
>   printf("\nreport_stats() started.\n");
> 
>   /*
>    * We inherited a thread sigmask with all the signals
>    * blocked.  So, we can wait on whatever signals we're
>    * interested in and (as long as no other thread waits
>    * for them) we'll be sure return from sigwait() to
>    * handle it.
>    */
> 
>   /* set this thread's signal mask to block out SIGUSR1 */
>   sigemptyset(&sigs_to_catch);
>   sigaddset(&sigs_to_catch, SIGUSR1);
> 
>   for (;;) {
>      sigwait(&sigs_to_catch, &caught);
> 
>      pthread_mutex_lock(&stats_lock);
>      mean = total/samples;
>      printf("\nreport_stats(): mean = %d, samples = %d\n", mean, samples);
>      pthread_mutex_unlock(&stats_lock);
>   }
>   return NULL;
> }
> /*
>  * worker_thread --
>  *
>  * Don't read too much into what this thread does.  It's
>  * a very simpleminded example.  The only interesting thing
>  * it does is write to the global statistics data-- which
>  * means the thread processing the signal has to protect
>  * against simultaneous access.
>  */
> void *worker_thread(void *p)
> {
> int item;
> time_t now;
> int *amtp=(int *)p;
> 
>   for (;;) {
> 
>     sleep((*amtp)*9);
> 
>     now = time(NULL);
> 
>     pthread_mutex_lock(&stats_lock);
>     total+=((int)now)%60; /* probably not the safest thing to do but
>                   it's just an example */
>     samples++;
>     pthread_mutex_unlock(&stats_lock);
>   }
>   /* Won't get here.  */
>   return NULL;
> }
> 
> extern int
> main(void)
> {
>   int       i;
>   pthread_t threads[MAX_NUM_THREADS];
>   int       num_threads = 0;
>   sigset_t  sigs_to_block;
>   struct    sigaction action;
> 
>   /* Identify our thread */
>   printf("main() running in thread 0x%x\n", pthread_self());
> 
>   /*
>    * Set this thread's signal mask to block SIGUSR1
>    * Other thread's will inherit the mask
>    */
>   sigemptyset(&sigs_to_block);
>   sigaddset(&sigs_to_block, SIGUSR1);
>   pthread_sigmask(SIG_BLOCK, &sigs_to_block, NULL);
> 
>   /* spawn statistics reporting thread */
>   pthread_create(&threads[num_threads++],
>               NULL,
>            report_stats,
>            NULL);
> 
>   /* spawn the threads */
>   for (i=num_threads; i<MAX_NUM_THREADS; i++) {
>     pthread_create(&threads[num_threads++],
>              NULL,
>                    worker_thread,
>              &i);
>   }
> 
>   printf("main()\t\t\t\t%d threads created\n",num_threads);
> 
>   /* wait until all threads have finished */
>   for (i = 0; i < num_threads; i++) {
>     pthread_join(threads[i], NULL);
>     printf("main()\t\tjoined to thread %d \n", i);
>   }
> 
>   printf("main()\t\tall %d threads have finished. \n", num_threads);
> 
>   return 0;
> }

[-- Attachment #2: Type: text/html, Size: 11375 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-01-24 13:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-23  2:02 It doesn't work: using pthread_win32 library installation with MSVC++6 oliver.kramer
2002-01-23 12:59 ` Philipp Krause
2002-01-23 16:14 ` It doesn't work: using pthread_win32 library installation withMSVC++6 Ross Johnson
2002-01-24  5:44   ` Win32 Signals Panagiotis E. Hadjidoukas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).