This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Rename the *thread* functions to Perl_* to avoid clashes.
[perl5.git] / ext / threads / threads.h
CommitLineData
47ba8780
AB
1
2#include "EXTERN.h"
3#include "perl.h"
4#include "XSUB.h"
5#include <stdio.h>
6#include <stdlib.h>
7
8#ifdef WIN32
9#include <windows.h>
10#include <win32thread.h>
11#else
12#include <pthread.h>
13#include <thread.h>
14#endif
15
16typedef struct {
17 PerlInterpreter *interp; /* The threads interpreter */
18 I32 tid; /* Our thread */
19 perl_mutex mutex; /* our mutex */
20 I32 count; /* how many threads have a reference to us */
21 signed char detached; /* are we detached ? */
22 SV* init_function;
23 SV* params;
24#ifdef WIN32
25 DWORD thr;
26 HANDLE handle;
27#else
28 pthread_t thr;
29#endif
30} ithread;
31
32
33
34static perl_mutex create_mutex; /* protects the creation of threads ??? */
35
36
37
38I32 tid_counter = 1;
39shared_sv* threads;
40
41
42
43
44
45
46/* internal functions */
47#ifdef WIN32
e6e315b9 48THREAD_RET_TYPE Perl_thread_run(LPVOID arg);
47ba8780 49#else
e6e315b9 50void Perl_thread_run(ithread* thread);
47ba8780 51#endif
e6e315b9 52void Perl_thread_destruct(ithread* thread);
47ba8780
AB
53
54/* Perl mapped functions to iThread:: */
e6e315b9
AB
55SV* Perl_thread_create(char* class, SV* function_to_call, SV* params);
56I32 Perl_thread_tid (SV* obj);
57void Perl_thread_join(SV* obj);
58void Perl_thread_detach(SV* obj);
59SV* Perl_thread_self (char* class);
47ba8780
AB
60
61
62
63
64
65
66
67
68