Thanks, I will use fprintf to catch the pointer value.
Before I post the problem on the forum, I tried to use
But the problem still happened.
Then the problem has nothing to do with that line.
Quote:
I have another idea, is it the problem cause by different compile options?
-O3 by itself doesn't cause it to crash. However it can expose latent bugs in your program.
Quote:
Besides, I used outl(...), iopl(...) to control SPI. Are they also affect this threading?
This is an extremely poor design and I can't guarantee anything about it. Given the way modern systems work I can't even guarantee you're actually talking to I/O ports. Is it possible to use an actual device driver instead?
I have written a program which takes a directory as command line arguments and displays all the dir and files in it.
I don't know why I have a problem with the /etc directory.It displays all the directories and files untill it reaches a sub directory called peers which is in /etc/ppp/peers.the... (4 Replies)
ive written my code in C for implementation of a simple lexical analyser using singly linked list hence am making use of dynamic allocation,but when run in linux it gives a segmentation fault is it cause of the malloc function that ive made use of????any suggestions as to what i could do???
thank... (8 Replies)
Hi ,
During execution a backup binary i get following error
"Program error 11 (Segmentation fault), saving core file in '/usr/datatools"
Riyaz (2 Replies)
If I do this.
Assume
struct life
{
char *nolife;
}
struct life **life;
// malloc initialization & everything
if(life->nolife == 0)
Would I get error at life->nolife if it is equal to 0.
wrong accession? (3 Replies)
This code is causing a segmentation fault and I can't figure out why. I'm new to UNIX and I need to learn how to avoid this segmentation fault thing. Thank you so much. Thanks also for the great answers to my last post.:):b:
int main()
{
mysqlpp::Connection conn(false);
if... (3 Replies)
i have this code
int already_there(char *client_names, char *username) {
int i;
for(i = 0; i<NUM; i++) {
printf("HERE\n");
if (strcmp(client_names, username)==0) return(1);
}
return(0);
}
and i get a segmentation fault, whats wrong here? (7 Replies)
I use a binary name (ie polo) it gets some parameter , so for debugging normally i do this :
i wrote script for watchdog my app (polo) and check every second if it's not running then start it , the problem is , if my app , remain in state of segmentation fault for a while (ie 15 ... (6 Replies)
I keep getting this fault on a lot of the codes I write, I'm not exactly sure why so I'd really appreciate it if someone could explain the idea to me.
For example this code
#include <stdio.h>
main()
{
unsigned long a=0;
unsigned long b=0;
int z;
{
printf("Enter two... (2 Replies)
Oddities with gcc, 2.95.3 for the AMIGA and 4.2.1 for MY current OSX 10.14.1...
I am creating a basic calculator for the AMIGA ADE *NIX emulator in C as it does not have one.
Below are two very condensed snippets of which I have added the results inside the each code section.
IMPORTANT!... (11 Replies)
Discussion started by: wisecracker
11 Replies
LEARN ABOUT NETBSD
pthread_getattr_np
PTHREAD_ATTR_GET_NP(3) BSD Library Functions Manual PTHREAD_ATTR_GET_NP(3)NAME
pthread_attr_get_np -- get attributes of existing thread
LIBRARY
POSIX Threads Library (libpthread, -lpthread)
SYNOPSIS
#include <pthread.h>
int
pthread_attr_get_np(pthread_t thread, pthread_attr_t *attr);
int
pthread_getattr_np(pthread_t thread, pthread_attr_t *attr);
DESCRIPTION
The pthread_attr_get_np() and pthread_getattr_np() functions can be used to retrieve attributes of a running thread. The result is stored to
attr.
For pthread_attr_get_np() attr should be initialized prior to the call by using pthread_attr_init(3). pthread_getattr_np() does this auto-
matically.
For both functions attr should be freed when it is not in use anymore with pthread_attr_destroy(3).
Most fields of attr are the same ones provided during thread creation time as a parameter to pthread_create(3). The exceptions include:
o The detach state -- a joinable thread may have detached itself after the creation.
o The guard size, which may vary if the application has allocated its own thread stack.
o The stack address and size; pthread_attr_get_np() will always return the thread's real stack address and size, regardless of the
values in the original attributes structure.
The returned pthread_attr_t structure is supposed to be used in conjunction with the pthread_attr_get*() functions to retrieve individual
values from the structure. When the returned attr is no longer needed, it should be destroyed by using pthread_attr_destroy(3).
RETURN VALUES
Upon successful completion, pthread_attr_get_np() and pthread_getattr_np() return 0. Otherwise an error number is returned to indicate the
error.
COMPATIBILITY
The pthread_attr_get_np() and pthread_getattr_np() functions are non-standard extensions.
ERRORS
The pthread_attr_get_np() and pthread_getattr_np() functions will fail if:
[ENOMEM] Insufficient memory.
[ESRCH] Non-existent thread.
SEE ALSO pthread(3), pthread_attr(3)BSD August 6, 2010 BSD