PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : clone



msi
19-10-2002, 15:44
hallo,

ich komme mit der funktion clone nicht klar.
die gibts einmal mit nur einem argument und
einmal mit ganz vielen.
ich will einfach nur einen thread erstellen,
kann mir dazu vielleicht jemand ein Beispiel
posten???
und mir erklären wiesos die funktion zweimal gibt.

danke Markus

anda_skoa
19-10-2002, 16:00
Laut man 2 clone gibt es da nur eine Version.

Außerdem:


CONFORMING TO
The clone and sys_clone calls are Linux-specific and should not be used
in programs intended to be portable. For programming threaded applica-
tions (multiple threads of control in the same memory space), it is
better to use a library implementing the POSIX 1003.1c thread API, such
as the LinuxThreads library (included in glibc2). See pthread_cre-
ate(3).


Ciao,
_

msi
19-10-2002, 16:17
ok aber mich würds trotzdem interessieren wie das mit clone
geht.

anda_skoa
19-10-2002, 16:54
Ich kann dir da nicht helfen, die Funktion ist mir zu hoch.
Vorallem, wie man den Stackpointer sinnvollerweise generiert.

Ciao,
_

maceop
19-10-2002, 17:27
du meinst das clone() mit dem man neue Prozesse erzeugen kann ? da gibts nur das eine, das wie anda_skoa schon gesagt hat nur ein argument hat.

zur erstellung eines threads benötigst du u.a. pthread_create()..

maceop

anda_skoa
19-10-2002, 18:05
Original geschrieben von maceop
du meinst das clone() mit dem man neue Prozesse erzeugen kann ? da gibts nur das eine, das wie anda_skoa schon gesagt hat nur ein argument hat.


Äh, das hab ich nicht gesagt :confused:
clone hat bei mir 4 Argumente.

Ciao,
_