* Hope this is the last bug fix in the wxThread merge ...

* configure updated
* some function added in utilsgtk.cpp (wxSleep, wxKill)
* wxThread sample v0.1


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@106 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Guilhem Lavaux 1998-06-16 17:17:02 +00:00
parent d1c9bbf64d
commit 82052affa7
27 changed files with 1084 additions and 412 deletions

View File

@ -83,7 +83,7 @@ to check that out automatically.
Thread support:
Requires pthreads under Linux without glibc.
Requires pthreads under Linux without glibc or glibc 2.
OpenGl:
@ -318,4 +318,4 @@ In the hope that it will be useful,
Robert Roebling roebling@sun2.ruf.uni-freiburg.de

644
install/gtk/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -494,9 +494,6 @@ dnl ############################
dnl # checks library functions #
dnl ############################
UNIX_THREAD=gtk/threadno.cpp
AC_CHECK_LIB(pthread, pthread_create, [UNIX_THREAD=gtk/threadpsx.cpp])
dnl ##########################
dnl # checks system services #
dnl ##########################
@ -504,11 +501,25 @@ dnl ##########################
dnl ##### Threads #####
UNIX_THREAD="gtk/threadno.cpp"
AC_CHECK_LIB(pthread, pthread_create, [UNIX_THREAD="gtk/threadpsx.cpp"])
AC_CHECK_LIB(pthreads, pthread_create, [UNIX_THREAD="gtk/threadpsx.cpp"])
AC_CHECK_HEADER(sys/prctl.h, [UNIX_THREAD="gtk/threadsgi.cpp"])
AC_CHECK_LIB(pthread, pthread_create, [
UNIX_THREAD="gtk/threadpsx.cpp"
THREADS_LINK="-lpthread"
AC_DEFINE(USE_THREADS)
])
AC_CHECK_LIB(pthreads, pthread_create, [
UNIX_THREAD="gtk/threadpsx.cpp"
THREADS_LINK="-lpthreads"
AC_DEFINE(USE_THREADS)
])
AC_CHECK_HEADER(sys/prctl.h, [
UNIX_THREAD="gtk/threadsgi.cpp"
AC_DEFINE(USE_THREADS)
])
AC_SUBST(UNIX_THREAD)
AC_SUBST(THREADS_LINK)
dnl defines UNIX_THREAD it contains the source file to use for threads. (GL)
dnl defines THREADS_LINK it contains the thread library to link with. (GL)
dnl defines USE_THREADS if thread support is activated. (GL)
AC_SYS_LONG_FILE_NAMES
dnl defines HAVE_LONG_FILENAMES if filenames longer then
@ -672,9 +683,6 @@ DEFAULT_WX_NORMALIZED_PS_FONTS=1
DEFAULT_USE_IOSTREAMH=1
DEFAULT_USE_THREADS=0
DEFAULT_USE_THREADS_SGI=0
DEFAULT_USE_THREADS_POSIX=0
DEFAULT_USE_OPENGL=0
DEFAULT_USE_WXCONFIG=1
@ -747,10 +755,6 @@ AC_OVERRIDES(libpng,libpng,
**--with-libpng use libpng (PNG image format),
USE_LIBPNG)
AC_OVERRIDES(threads,threads,
**--with-threads use threads,
USE_THREADS)
AC_OVERRIDES(opengl,opengl,
**--with-opengl use opengl (OpenGL or Mesa),
USE_OPENGL)
@ -892,26 +896,6 @@ if test "$USE_LIBPNG" = 1 ; then
LIBPNG="LIBPNG"
fi
THREADS=NONE
THREADS_LINK=
if test "$USE_THREADS" = 1 ; then
case "$OS" in iris | IRIX | Irix5 | Irix6)
USE_THREADS_POSIX=0
USE_THREADS_SGI=1
;;
*)
USE_THREADS_POSIX=1
USE_THREADS_SGI=0
THREADS_LINK=-lpthread
;;
esac
THREADS="THREADS"
AC_DEFINE_UNQUOTED(USE_THREADS,$USE_THREADS)
AC_DEFINE_UNQUOTED(USE_THREADS_SGI,$USE_THREADS_SGI)
AC_DEFINE_UNQUOTED(USE_THREADS_POSIX,$USE_THREADS_POSIX)
fi
AC_SUBST(THREADS)
AC_SUBST(THREADS_LINK)
STORABLE=NONE
if test "$USE_STORABLE_CLASSES" = 1 ; then

1
samples/thread/Makefile Normal file
View File

@ -0,0 +1 @@
include ../../src/gtk/setup/general/makeapp

View File

@ -0,0 +1,26 @@
# WXXT base directory
WXBASEDIR=@WXBASEDIR@
# set the OS type for compilation
OS=@OS@
# compile a library only
RULE=bin
# define library name
BIN_TARGET=test
# define library sources
BIN_SRC=\
test.cpp
#define library objects
BIN_OBJ=\
test.o
# additional things needed to link
BIN_LINK= $(THREADS_LINK)
# additional things needed to compile
ADD_COMPILE=
# include the definitions now
include ../../../template.mak

BIN
samples/thread/aiai.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

38
samples/thread/aiai.xbm Normal file
View File

@ -0,0 +1,38 @@
#define aiai_width 64
#define aiai_height 64
static char aiai_bits[] = {
0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
0x11,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,
0x44,0x44,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
0x11,0x11,0x11,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,
0x44,0x44,0x44,0x44,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
0x11,0x11,0x11,0x11,0x11,0x44,0x44,0x44,0x42,0x44,0x44,0x44,0x44,0x44,0x44,
0x44,0x47,0x44,0x44,0x44,0x44,0x11,0x11,0x11,0x17,0x11,0x11,0x11,0x11,0x11,
0x11,0x91,0x1f,0x11,0x11,0x11,0x11,0x44,0x44,0xc4,0x4f,0x44,0x44,0x44,0x44,
0x44,0x44,0xc4,0x5f,0x44,0xf4,0x45,0x44,0x11,0x11,0xf1,0x1f,0x11,0xf9,0x13,
0x11,0x11,0x11,0xf1,0x3f,0x11,0xfd,0x13,0x11,0x44,0x44,0xf4,0x7f,0x44,0xfc,
0x47,0x44,0x44,0x44,0xf4,0x7f,0x44,0xfc,0x47,0x44,0x11,0x11,0xf9,0x7f,0x11,
0xf9,0x13,0x11,0x11,0x11,0xfd,0xff,0x11,0xf1,0x11,0x11,0x44,0x44,0xfc,0xff,
0x44,0x44,0x44,0x44,0x44,0x44,0xfe,0xff,0x45,0x44,0x44,0x44,0x11,0x11,0xff,
0xff,0x11,0xfd,0x13,0x11,0x11,0x11,0xff,0xff,0x13,0xfd,0x13,0x11,0x44,0xc4,
0xff,0xff,0x07,0xfc,0x43,0x44,0x44,0xff,0xff,0xf9,0xff,0xfd,0xfb,0xff,0x11,
0xc0,0xff,0x00,0x00,0xfc,0x03,0x00,0x11,0xc0,0x7f,0x00,0x00,0xfc,0x03,0x00,
0x04,0xe0,0x7f,0x00,0x00,0xfc,0x03,0x00,0xf4,0xf7,0xbf,0xff,0xff,0xfd,0xfb,
0x7f,0x01,0xf0,0x1f,0x00,0x00,0xfc,0x03,0x00,0x01,0xf8,0x1f,0x00,0x00,0xfc,
0x03,0x00,0x00,0xfc,0x0f,0x00,0x00,0xfc,0x03,0x40,0xfe,0xfd,0xef,0xff,0xff,
0xfd,0xfb,0x4f,0x00,0xfe,0x07,0x00,0x00,0xfc,0x03,0x10,0x00,0xfe,0x03,0x00,
0x00,0xfc,0x03,0x10,0x00,0xff,0x03,0x00,0x00,0xfc,0x03,0x44,0x7f,0xff,0x01,
0x00,0x00,0xfc,0xfb,0x44,0x91,0xff,0xff,0xff,0xff,0xff,0x13,0x11,0xd1,0xff,
0xff,0xff,0xff,0xff,0x13,0x11,0xe4,0xff,0xff,0xff,0xff,0xff,0x47,0x44,0xe4,
0xff,0xff,0xff,0xff,0xff,0x47,0x44,0xf1,0xff,0xff,0xff,0xff,0xff,0x13,0x11,
0xf1,0xff,0xff,0xff,0xff,0xff,0x13,0x11,0xfc,0xff,0xff,0xff,0xff,0xff,0x47,
0x44,0xfc,0xff,0xff,0xff,0xff,0xff,0x47,0x44,0x11,0x11,0x11,0x11,0x11,0x11,
0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x10,0x11,0x44,0x44,0xc4,0x44,0x44,
0xc4,0x44,0x44,0x44,0x4e,0xc4,0x44,0x4e,0xc4,0x44,0x44,0x11,0x1f,0xd1,0x11,
0x1f,0xd1,0x11,0x11,0x91,0x31,0xd1,0x91,0x31,0xd1,0x11,0x11,0xc4,0x64,0xcc,
0xcc,0x64,0xcc,0x44,0x44,0x64,0xc4,0xcc,0x6c,0xc4,0xcc,0x44,0x44,0xf1,0xff,
0xd1,0xf1,0xff,0xd1,0x11,0x11,0xf9,0xff,0xd3,0xf9,0xff,0xd3,0x11,0x11,0x4c,
0x44,0xc6,0x4c,0x44,0xc6,0x44,0x44,0x4c,0x44,0xc6,0x4c,0x44,0xc6,0x44,0x44,
0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
0x11,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,
0x44,0x44};

View File

@ -0,0 +1,64 @@
#
# File: makefile.bcc
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile : Builds thread example (DOS).
# WXWIN and BCCDIR are set by parent make
WXDIR = $(WXWIN)
!include $(WXDIR)\src\makeb32.env
WXLIBDIR = $(WXDIR)\lib
WXINC = $(WXDIR)\include\msw
WXLIB = $(WXLIBDIR)\wx32.lib
LIBS=$(WXLIB) cw32 import32 ole2w32
TARGET=test
!if "$(FINAL)" == "0"
LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
OPT = -Od
DEBUG_FLAGS= -v
!else
LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
OPT = -Od
DEBUG_FLAGS =
!endif
CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
OBJECTS = test.obj
$(TARGET).exe: $(OBJECTS) $(TARGET).def $(TARGET).res
tlink32 $(LINKFLAGS) @&&!
c0w32.obj $(OBJECTS)
$(TARGET)
nul
$(LIBS)
$(TARGET).def
!
brc32 -K $(TARGET).res
.$(SRCSUFF).obj:
bcc32 $(CPPFLAGS) -c {$< }
.c.obj:
bcc32 $(CPPFLAGS) -P- -c {$< }
test.obj: test.$(SRCSUFF)
$(TARGET).res : $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET)
clean:
-erase *.obj
-erase *.exe
-erase *.res
-erase *.map
-erase *.rws

View File

@ -0,0 +1,73 @@
#
# File: makefile.bcc
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile : Builds thread example (DOS).
!if "$(BCCDIR)" == ""
!error You must define the BCCDIR variable in autoexec.bat, e.g. BCCDIR=d:\bc4
!endif
!if "$(WXWIN)" == ""
!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
!endif
WXDIR = $(WXWIN)
!include $(WXDIR)\src\makebcc.env
THISDIR = $(WXDIR)\samples\test
WXLIB = $(WXDIR)\lib\wx.lib
LIBS=$(WXLIB) mathwl cwl import
INC=-I$(WXDIR)\include\base -I$(WXDIR)\include\msw
CFG=$(WXDIR)\src\wxwin.cfg
!ifndef FINAL
FINAL=0
!endif
!if "$(FINAL)" == "0"
LINKFLAGS=/v/Vt /Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
OPT = -Od
DEBUG_FLAGS= -v
!else
LINKFLAGS=/Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
OPT = -O2
DEBUG_FLAGS=
!endif
CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
OBJECTS = test.obj
test: test.exe
all: test.exe
test.exe: $(WXLIB) test.obj test.def test.res
tlink $(LINKFLAGS) @&&!
c0wl.obj test.obj
test
nul
$(LIBS)
test.def
!
rc -31 -K test.res
.$(SRCSUFF).obj:
bcc $(CPPFLAGS) -c {$< }
test.obj: test.$(SRCSUFF)
test.res : test.rc $(WXDIR)\include\msw\wx.rc
rc -r /i$(BCCDIR)\include /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa test
clean:
-erase *.obj
-erase *.exe
-erase *.res
-erase *.map
-erase *.rws

View File

@ -0,0 +1,65 @@
#
# File: makefile.dos
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile : Builds thread example (DOS).
# Use FINAL=1 argument to nmake to build final version with no debugging
# info
WXDIR = $(WXWIN)
!include $(WXDIR)\src\makemsc.env
THISDIR = $(WXDIR)\samples\test
!ifndef FINAL
FINAL=0
!endif
HEADERS =
SOURCES = test.$(SRCSUFF)
OBJECTS = test.obj
all: test.exe
wx:
cd $(WXDIR)\src\msw
nmake -f makefile.dos FINAL=$(FINAL)
cd $(THISDIR)
wxclean:
cd $(WXDIR)\src\msw
nmake -f makefile.dos clean
cd $(THISDIR)
test.exe: $(WXDIR)\src\msw\dummy.obj $(WXLIB) test.obj test.def test.res
link $(LINKFLAGS) @<<
test.obj $(WXDIR)\src\msw\dummy.obj,
test,
NUL,
$(LIBS),
test.def
;
<<
rc -K test.res
test.obj: test.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
test.res : test.rc $(WXDIR)\include\wx\msw\wx.rc
rc -r /i$(WXDIR)\include test
clean:
-erase *.obj
-erase *.exe
-erase *.res
-erase *.map
-erase *.sbr
-erase *.pdb

View File

@ -0,0 +1,37 @@
#
# File: makefile.unx
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile for thread example (UNIX).
WXDIR = ../..
# All common UNIX compiler flags and options are now in
# this central makefile.
include $(WXDIR)/src/makeg95.env
OBJECTS = $(OBJDIR)/test.$(OBJSUFF) $(OBJDIR)/test_resources.$(OBJSUFF)
all: $(OBJDIR) test$(GUISUFFIX)$(EXESUFF)
wx:
$(OBJDIR):
mkdir $(OBJDIR)
test$(GUISUFFIX)$(EXESUFF): $(OBJECTS) $(WXLIB)
$(CC) $(LDFLAGS) -o test$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
$(OBJDIR)/test.$(OBJSUFF): test.$(SRCSUFF)
$(CC) -c $(CPPFLAGS) -o $@ test.$(SRCSUFF)
$(OBJDIR)/test_resources.o: test.rc
$(RESCOMP) -i test.rc -o $(OBJDIR)/test_resources.o $(RESFLAGS)
clean:
rm -f $(OBJECTS) test$(GUISUFFIX).exe core *.rsc *.res

View File

@ -0,0 +1,64 @@
#
# File: makefile.nt
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile : Builds thread example (MS VC++).
# Use FINAL=1 argument to nmake to build final version with no debugging
# info
# Set WXDIR for your system
WXDIR = $(WXWIN)
WXUSINGDLL=0
!include $(WXDIR)\src\ntwxwin.mak
THISDIR = $(WXDIR)\samples\test
PROGRAM=test
OBJECTS = $(PROGRAM).obj
$(PROGRAM): $(PROGRAM).exe
all: wx $(PROGRAM).exe
wx:
cd $(WXDIR)\src\msw
nmake -f makefile.nt FINAL=$(FINAL)
cd $(THISDIR)
wxclean:
cd $(WXDIR)\src\msw
nmake -f makefile.nt clean
cd $(THISDIR)
$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res
$(link) @<<
-out:$(PROGRAM).exe
$(LINKFLAGS)
$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
$(LIBS)
<<
$(PROGRAM).obj: $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ)
$(cc) @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc
$(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
clean:
-erase *.obj
-erase *.exe
-erase *.res
-erase *.map
-erase *.sbr
-erase *.pdb

View File

@ -0,0 +1,35 @@
# Symantec C++ makefile for thread example
# NOTE that peripheral libraries are now dealt in main wxWindows makefile.
WXDIR = $(WXWIN)
!include $(WXDIR)\src\makesc.env
WXLIB = $(WXDIR)\lib\wx.lib
INCDIR = $(WXDIR)\include
MSWINC = $(INCDIR)\msw
BASEINC = $(INCDIR)\base
CC=sc
RC=rc
CFLAGS = -o -ml -W -Dwx_msw
LDFLAGS = -ml -W
INCLUDE=$(BASEINC);$(MSWINC)
LIBS=$(WXLIB) libw.lib commdlg.lib shell.lib
.$(SRCSUFF).obj:
*$(CC) -c $(CFLAGS) -I$(INCLUDE) $<
.rc.res:
*$(RC) -r -I$(INCLUDE) $<
test.exe: test.obj test.def test.res
*$(CC) $(LDFLAGS) -o$@ $** $(LIBS)
clean:
-del *.obj
-del *.exe
-del *.res
-del *.map
-del *.rws

View File

@ -0,0 +1,58 @@
#
# File: makefile.unx
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile for thread example (UNIX).
WXDIR = ../..
# All common UNIX compiler flags and options are now in
# this central makefile.
include $(WXDIR)/src/make.env
OBJECTS = $(OBJDIR)/test.$(OBJSUFF)
.SUFFIXES:
all: $(OBJDIR) test$(GUISUFFIX)
wx:
motif:
$(MAKE) -f makefile.unx GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' WXLIB=$(WXDIR)/lib/libwx_motif.a OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK=
xview:
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx xview
$(MAKE) -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol CC=$(CC) OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)'
hp:
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx hp
$(MAKE) -f makefile.unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC DEBUG='$(DEBUG)' WARN='-w' \
XINCLUDE='$(HPXINCLUDE)' XLIB='$(HPXLIB)' XVIEW_LINK='' LDLIBS='$(HPLDLIBS)'
$(OBJDIR):
mkdir $(OBJDIR)
test$(GUISUFFIX): $(OBJDIR)/test.$(OBJSUFF) $(WXLIB)
$(CC) $(LDFLAGS) -o test$(GUISUFFIX) $(OBJDIR)/test.$(OBJSUFF) $(XVIEW_LINK) $(LDLIBS)
$(OBJDIR)/test.$(OBJSUFF): test.$(SRCSUFF)
$(CC) -c $(CPPFLAGS) -o $@ test.$(SRCSUFF)
clean_motif:
$(MAKE) -f makefile.unx GUISUFFIX=_motif cleanany
clean_ol:
$(MAKE) -f makefile.unx GUISUFFIX=_ol cleanany
clean_hp:
$(MAKE) -f makefile.unx GUISUFFIX=_hp cleanany
cleanany:
rm -f $(OBJECTS) test$(GUISUFFIX) core

View File

@ -0,0 +1,38 @@
#************************************************************************
# Makefile for MINIMAL under VMS
# by Stefan Hammes
# (incomplete) update history:
# 11.04.95
#************************************************************************
#************************************************************************
# Definition section
# (cave: definitions and includes must begin with ',')
#************************************************************************
APPOPTS =
APPDEFS =
APPINCS =
#************************************************************************
# Module section
#************************************************************************
# Name of main module
MAIN = test
# Object modules of the application.
OBJS = test.obj
OBJLIST =test.obj
.include [--.src]makevms.env
# main dependency
$(MAIN).exe : $(OBJS)
$(LINK) $(LINKFLAGS) /exec=$(MAIN).exe $(OBJLIST),$(WXLIB)/lib,$(OPTSFILE)/option
- purge *.exe
#************************************************************************
# Header file depedencies following
#************************************************************************

View File

@ -0,0 +1,43 @@
#
# Makefile for WATCOM
#
# Created by D.Chubraev, chubraev@iem.ee.ethz.ch
# 8 Nov 1994
#
WXDIR = ..\..
!include $(WXDIR)\src\makewat.env
WXLIB = $(WXDIR)\lib
NAME = test
LNK = $(name).lnk
OBJS = $(name).obj
all: $(name).exe
$(name).exe : $(OBJS) $(name).res $(LNK) $(WXLIB)\wx$(LEVEL).lib
wlink @$(LNK)
$(BINDCOMMAND) $(name).res
$(name).res : $(name).rc $(WXDIR)\include\msw\wx.rc
$(RC) $(RESFLAGS1) $(name).rc
$(LNK) : makefile.wat
%create $(LNK)
@%append $(LNK) debug all
@%append $(LNK) system $(LINKOPTION)
@%append $(LNK) $(MINDATA)
@%append $(LNK) $(MAXDATA)
@%append $(LNK) $(STACK)
@%append $(LNK) name $(name)
@%append $(LNK) file $(WXLIB)\wx$(LEVEL).lib
@for %i in ($(EXTRALIBS)) do @%append $(LNK) file %i
@for %i in ($(OBJS)) do @%append $(LNK) file %i
thing: .SYMBOLIC
echo $(WATLIBDIR)
clean: .SYMBOLIC
-erase *.obj *.bak *.err *.pch *.lib *.lnk *.res *.exe

199
samples/thread/test.cpp Normal file
View File

@ -0,0 +1,199 @@
/////////////////////////////////////////////////////////////////////////////
// Name: test.cpp
// Purpose: wxWindows thread sample
// Author: Julian Smart(minimal)/Guilhem Lavaux(thread test)
// Modified by:
// Created: 06/16/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart, Markus Holzem, Guilhem Lavaux
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "test.cpp"
#pragma interface "test.cpp"
#endif
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "wx/thread.h"
#include "wx/dynarray.h"
// Define a new application type
class MyApp: public wxApp
{
public:
bool OnInit(void);
};
WX_DEFINE_ARRAY(wxThread *,wxArrayThread);
// Define a new frame type
class MyFrame: public wxFrame
{
public:
MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h);
public:
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnStartThread(wxCommandEvent& event);
void OnStopThread(wxCommandEvent& event);
void OnPauseThread(wxCommandEvent& event);
bool OnClose(void) { return TRUE; }
public:
wxArrayThread m_threads;
wxTextCtrl *m_txtctrl;
DECLARE_EVENT_TABLE()
};
class MyThread: public wxThread
{
public:
MyThread(MyFrame *frame);
void *Entry();
public:
MyFrame *m_frame;
};
MyThread::MyThread(MyFrame *frame)
: wxThread()
{
m_frame = frame;
}
void *MyThread::Entry()
{
wxString text;
text.Printf("Thread 0x%x: Hello !\n", GetID());
DeferDestroy(TRUE);
while (1) {
TestDestroy();
m_frame->m_txtctrl->WriteText(text);
wxSleep(1);
}
return NULL;
}
// ID for the menu commands
#define TEST_QUIT 1
#define TEST_TEXT 101
#define TEST_ABOUT 102
#define TEST_START_THREAD 103
#define TEST_STOP_THREAD 104
#define TEST_PAUSE_THREAD 105
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(TEST_QUIT, MyFrame::OnQuit)
EVT_MENU(TEST_ABOUT, MyFrame::OnAbout)
EVT_MENU(TEST_START_THREAD, MyFrame::OnStartThread)
EVT_MENU(TEST_STOP_THREAD, MyFrame::OnStopThread)
EVT_MENU(TEST_PAUSE_THREAD, MyFrame::OnPauseThread)
END_EVENT_TABLE()
// Create a new application object
IMPLEMENT_APP (MyApp)
// `Main program' equivalent, creating windows and returning main app frame
bool MyApp::OnInit(void)
{
// Create the main frame window
MyFrame *frame = new MyFrame(NULL, "Minimal wxWindows App", 50, 50, 450, 340);
// Give it an icon
#ifdef __WINDOWS__
frame->SetIcon(wxIcon("AIAI"));
#endif
#ifdef __X__
frame->SetIcon(wxIcon("aiai.xbm"));
#endif
// Make a menubar
wxMenu *file_menu = new wxMenu;
file_menu->Append(TEST_ABOUT, "&About");
file_menu->Append(TEST_QUIT, "E&xit");
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, "&File");
wxMenu *thread_menu = new wxMenu;
thread_menu->Append(TEST_START_THREAD, "Start a new thread");
thread_menu->Append(TEST_STOP_THREAD, "Stop a running thread");
thread_menu->Append(TEST_PAUSE_THREAD, "Pause a running thread");
menu_bar->Append(thread_menu, "Thread");
frame->SetMenuBar(menu_bar);
// Make a panel with a message
wxPanel *panel = new wxPanel(frame, -1, wxPoint(0, 0), wxSize(400, 200), wxTAB_TRAVERSAL);
frame->m_txtctrl = new wxTextCtrl(panel, -1, "", wxPoint(10, 10), wxSize(390, 190),
wxTE_MULTILINE);
// Show the frame
frame->Show(TRUE);
SetTopWindow(frame);
return TRUE;
}
// My frame constructor
MyFrame::MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h):
wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h))
{}
void MyFrame::OnStartThread(wxCommandEvent& event)
{
MyThread *thread = new MyThread(this);
thread->Create();
m_threads.Add(thread);
}
void MyFrame::OnStopThread(wxCommandEvent& event)
{
uint no_thrd = m_threads.Count()-1;
if (no_thrd < 0)
return;
delete (m_threads[no_thrd]);
m_threads.Remove(no_thrd);
}
void MyFrame::OnPauseThread(wxCommandEvent& event)
{}
void MyFrame::OnQuit(wxCommandEvent& event)
{
uint i;
for (i=0;i<m_threads.Count();i++)
delete (m_threads[i]);
Close(TRUE);
}
void MyFrame::OnAbout(wxCommandEvent& event)
{
wxMessageDialog dialog(this, "wxThread sample (based on minimal)\nJulian Smart and Guilhem Lavaux",
"About wxThread sample", wxYES_NO|wxCANCEL);
dialog.ShowModal();
}

8
samples/thread/test.def Normal file
View File

@ -0,0 +1,8 @@
NAME Minimal
DESCRIPTION 'Minimal wxWindows application'
EXETYPE WINDOWS
STUB 'WINSTUB.EXE'
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE MULTIPLE
HEAPSIZE 4048
STACKSIZE 16000

3
samples/thread/test.rc Normal file
View File

@ -0,0 +1,3 @@
AIAI ICON "aiai.ico"
#include "wx/msw/wx.rc"

View File

@ -56,8 +56,6 @@
* Use Threads
*/
#undef USE_THREADS
#undef USE_THREADS_POSIX
#undef USE_THREADS_SGI
/*
* Use storable classes
*/

View File

@ -16,6 +16,9 @@
#include <unistd.h>
#include <sched.h>
#include <pthread.h>
#include "wx/thread.h"
#include "wx/module.h"
#include "wx/utils.h"
enum thread_state {
STATE_IDLE = 0,
@ -28,8 +31,6 @@ enum thread_state {
// Static variables
/////////////////////////////////////////////////////////////////////////////
#include "wx/thread.h"
static pthread_t p_mainid;
wxMutex wxMainMutex; // controls access to all GUI functions

View File

@ -18,6 +18,9 @@
#include <signal.h>
#include <sys/wait.h>
#include <sys/prctl.h>
#include "wx/thread.h"
#include "wx/module.h"
#include "wx/utils.h"
enum thread_state {
STATE_IDLE = 0,
@ -30,8 +33,6 @@ enum thread_state {
// Static variables
/////////////////////////////////////////////////////////////////////////////
#include "wx/thread.h"
static int p_mainid;
wxMutex wxMainMutex;

View File

@ -26,6 +26,7 @@
#include <pwd.h>
#include <errno.h>
#include <netdb.h>
#include <signal.h>
#ifdef __SVR4__
#include <sys/systeminfo.h>
@ -40,6 +41,16 @@ void wxBell(void)
gdk_beep();
};
void wxSleep(int nSecs)
{
sleep(nSecs);
};
int wxKill(long pid, int sig)
{
return kill(pid, sig);
};
//------------------------------------------------------------------------
// user and home routines
//------------------------------------------------------------------------

View File

@ -56,8 +56,6 @@
* Use Threads
*/
#undef USE_THREADS
#undef USE_THREADS_POSIX
#undef USE_THREADS_SGI
/*
* Use storable classes
*/

View File

@ -16,6 +16,9 @@
#include <unistd.h>
#include <sched.h>
#include <pthread.h>
#include "wx/thread.h"
#include "wx/module.h"
#include "wx/utils.h"
enum thread_state {
STATE_IDLE = 0,
@ -28,8 +31,6 @@ enum thread_state {
// Static variables
/////////////////////////////////////////////////////////////////////////////
#include "wx/thread.h"
static pthread_t p_mainid;
wxMutex wxMainMutex; // controls access to all GUI functions

View File

@ -18,6 +18,9 @@
#include <signal.h>
#include <sys/wait.h>
#include <sys/prctl.h>
#include "wx/thread.h"
#include "wx/module.h"
#include "wx/utils.h"
enum thread_state {
STATE_IDLE = 0,
@ -30,8 +33,6 @@ enum thread_state {
// Static variables
/////////////////////////////////////////////////////////////////////////////
#include "wx/thread.h"
static int p_mainid;
wxMutex wxMainMutex;

View File

@ -26,6 +26,7 @@
#include <pwd.h>
#include <errno.h>
#include <netdb.h>
#include <signal.h>
#ifdef __SVR4__
#include <sys/systeminfo.h>
@ -40,6 +41,16 @@ void wxBell(void)
gdk_beep();
};
void wxSleep(int nSecs)
{
sleep(nSecs);
};
int wxKill(long pid, int sig)
{
return kill(pid, sig);
};
//------------------------------------------------------------------------
// user and home routines
//------------------------------------------------------------------------