Search Results

Search: Posts Made By: dawwin
Forum: Programming 09-01-2010
4,634
Posted By dawwin
Try this #include <stdio.h> #include...
Try this

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

int main()
{
int i;
int nproc = 3;
pid_t pid;

for (i = 0;i < nproc;i++) {
switch ((pid =...
Forum: Programming 09-01-2010
4,634
Posted By dawwin
After add exit(0); after printf("I am CHILD...
After add exit(0); after printf("I am CHILD %d\n", count);
It prints this on my computer
I am CHILD 0
I am CHILD 1
I am CHILD 2
parent exited..


What system you've got?
Forum: Programming 09-01-2010
4,634
Posted By dawwin
Try to add fflush(stdout); After each...
Try to add
fflush(stdout);

After each call of printf()
Forum: Programming 08-12-2010
11,565
Posted By dawwin
This code was just an example. I just wanted to...
This code was just an example. I just wanted to know, why bigger stack can allow to create more threads than default
Forum: Programming 08-12-2010
11,565
Posted By dawwin
#include <stdio.h> #include <pthread.h> ...
#include <stdio.h>
#include <pthread.h>

#define MODIFY_STACK

void *fnc(void *a)
{
sleep(99999);
return NULL;
}

int main()
{
int i = 0;
pthread_t abc;...
Forum: Programming 08-12-2010
11,565
Posted By dawwin
Threads and stack size
Can someone explain me, why when I create new threads with stack bigger than default (using pthread_attr_setstacksize()) i can create more? Each thread has it's own stack, so how bigger stack can...
Forum: Programming 08-03-2010
3,439
Posted By dawwin
So I don't have to use -pthread or -D_REENTRANT? ...
So I don't have to use -pthread or -D_REENTRANT?
I use -lpthread only when linking. For example:
gcc test.c -c -o test.o
gcc test.o -lpthread
Isn't that incorrect? (I know -l is linker option,...
Forum: Programming 08-03-2010
3,439
Posted By dawwin
Linux x86, x86_64 and FreeBSD x86, x86_64
Linux x86, x86_64 and FreeBSD x86, x86_64
Forum: Programming 08-03-2010
3,439
Posted By dawwin
[c] is -lpthread correct option?
I read somewhere that I should use -pthread instead of -lpthread as compiler/linker flag, or define _REENTRANT. Is this incorrect to use only -lpthread? (I use gcc)
Forum: Programming 07-29-2010
4,268
Posted By dawwin
Yes, I use linux. Thanks for help
Yes, I use linux.
Thanks for help
Forum: Programming 07-29-2010
4,268
Posted By dawwin
I saw this list, but I was confused, when I read...
I saw this list, but I was confused, when I read sources of scandir() (from glibc):

[...]
#define READDIR __readdir
[...]
while ((d = READDIR (dp)) != NULL)
[...]


readdir() isn't thread...
Forum: Programming 07-29-2010
4,268
Posted By dawwin
scandir() and threads
I couldn't find anywhere informations about it. Is scandir() thread-safe?
Showing results 1 to 12 of 12

 
All times are GMT -4. The time now is 01:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy